<    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 umib0zu joined
00:02 tikhon` left
00:03 tikhon joined
00:05 hydraz joined
00:05 Engen joined
00:06 limlinlo joined
00:08 <Engen> hey guys. I'm currently trying to understand a function given to me (yes it is hw) but I'm having difficulty in doing do, function found here: http://lpaste.net/353869
00:08 <Engen> the task is to check different properties of sorting functions using quickcheck and given properties of which the pasted code is one
00:09 <pacak> It checks that arbitrary element is still present in a given list after sorting
00:09 zar joined
00:09 BlueRavenGT joined
00:09 <c_wraith> Engen, that property checks that if an element is inserted between two list segments, and them the whole thing is sorted, that the element is still there.
00:09 <Engen> so far my understanding is; sortProp2 takes a function, an Int, and two lists of Int and returns a Bool
00:10 <pacak> Engen: Yep
00:10 verement joined
00:10 beerdrop joined
00:11 <Engen> I understood that it was checking if x was still in the list but what is going on the rhs of the `elem` is what is confusing me
00:11 suls joined
00:11 <pacak> :t elem
00:11 <lambdabot> (Eq a, Foldable t) => a -> t a -> Bool
00:12 <pacak> elem takes an element and a foldable, in this case - a list
00:12 <c_wraith> ah. backticks turn a prefix function into an operator.
00:12 <pacak> > 10 `mod` 2
00:12 <lambdabot> 0
00:12 <pacak> > mod 10 2
00:12 <c_wraith> so elem x xs is the same as x `elem` xs
00:12 <lambdabot> 0
00:12 Conjecture left
00:12 Netwolf joined
00:13 <pacak> You can go the other way as well
00:13 <pacak> > (+) 100 500
00:13 <lambdabot> 600
00:13 <pacak> > 100 + 500
00:13 <lambdabot> 600
00:13 <Engen> it concatenates xs to [x] to ys and sorts that data but whether the elem check or the sort happens first is not clear
00:13 <c_wraith> infix operators are always lower priority than function application
00:13 <pacak> sorts first
00:14 <Engen> sortProp2 sortFn x xs ys = x `elem` (sortFn (xs ++ [x] ++ ys)) is that... yeah ok gotcha
00:15 revprez joined
00:15 JoshS joined
00:15 <c_wraith> that's one of the primary reasons why people use functions as infix operators... it often lets them drop a set of parens.
00:16 <Engen> I see
00:17 DataComputist joined
00:17 <Rotaerk> it also sometimes reads more like english that way
00:17 nakal joined
00:17 <Rotaerk> "x is an element of ..."
00:19 eacameron joined
00:19 tromp joined
00:19 <tikhon> I've found people are pretty consistent with it: if a function makes sense as infix (elem, mod... etc), they write it as infix most of the time
00:19 <c_wraith> I don't really like typing ` very much, and so I use backticks on essentially only 4 functions. elem, div, mod, and rem.
00:19 <tikhon> it is an annoying character on a lot of keyboard layouts
00:20 <c_wraith> (somehow, quot didn't make the list)
00:20 jbiesnecker joined
00:20 <tikhon> and it's the default Emacs key for cycling through error >.<
00:20 <tikhon> I've typed C-x ` way too many times, but I'm too lazy to rebind it
00:20 phyrex1an joined
00:21 <c_wraith> Oh, I do use it for divMod and quotRem in the cases I use those. so... maybe 7 functions. not many, really. :)
00:22 <tikhon> I also use it to avoid using 'flip'
00:22 ChaiTRex joined
00:22 <tikhon> but I don't really know if that's a net gain or not :P
00:22 <Rotaerk> I don't like it most of the time because I tend to name my functions such that it grammatically makes sense in english to describe the first argument
00:23 <* ski> . o O ( foo `flip` bar )
00:23 Unhammer joined
00:23 justanotheruser joined
00:23 <tikhon> looking through our codebase at work, we use `min` and `max` a lot
00:23 <Rotaerk> isElement :: a -> [a] -> Bool versus isElementOf :: [a] -> a -> Bool
00:24 plutoniix joined
00:24 <Rotaerk> and if you used infix for the latter, it'd be ... myDict `isElementOf` 5
00:24 <Rotaerk> which looks wrong
00:25 <* ski> . o O ( `isElementOf :: a -> Bool <- [a]' )
00:25 <Rotaerk> s/myDict/myList/
00:26 <tikhon> my favorite example is a function I called "can" for determining whether a store has a particular capability
00:26 <tikhon> store `can` Fulfill
00:26 <tikhon> and then you can have a `can't` too :)
00:26 <tikhon> it actually reads really nicely in guards
00:28 <Rotaerk> I would prefer to make the capability the first argument of can, and if you want to make it englishy do: store & can Fulfill
00:29 umib0zu left
00:29 <Rotaerk> simply because I don't think functions should be designed *around* the infix notation, since they won't necessarily be used that way
00:29 <tikhon> hmm, not a bad idea
00:29 <tikhon> besides, looking through some of the examples in our code, we should have just defined operators for a few of them
00:29 <MarcelineVQ> > 2`subtract`8
00:30 <lambdabot> 6
00:30 <Rotaerk> infix notation, though, I think is fine for things where the order of arguments just doesn't matter
00:30 <Rotaerk> yea the order of args for subtract make sense to me
00:31 <MarcelineVQ> it does to me in prefix, subtract 2 from 8 infix is odd to me still
00:31 mson joined
00:32 nomotif joined
00:32 <Rotaerk> crap... drawing a blank ... a op b == b op a
00:32 <Rotaerk> that's called what?
00:32 <MarcelineVQ> and that it matters at all is just that I tend to use it infix becasue of the oddities of -
00:32 <tikhon> commutative
00:32 <Rotaerk> right
00:32 <Rotaerk> I think infix notation for functions is fine if they're commutative
00:32 <Rotaerk> otherwise you have to design the function *for* the notation, and then it looks wrong when you don't use it
00:32 <tikhon> I don't think that's always true
00:33 <tikhon> a lot of our code uses `zip` as infix, but it actually reads fine either way
00:33 <Rotaerk> hmm I guess commutative isn't the right property then...
00:33 <Rotaerk> though, zip is tricky in that case
00:33 halogenandtoast joined
00:34 <Rotaerk> a `zip` b versus zip a b
00:34 jbiesnecker joined
00:34 <Rotaerk> versus b & zip a
00:35 <Rotaerk> eh, I guess you're right
00:35 meandi_2 joined
00:35 Welkin joined
00:37 <monochrom> Infix is great for associative functions such as (+) and (*).
00:37 andyhuzhill joined
00:37 JuanDaugherty joined
00:38 <monochrom> There are also non-associative cases where infix is still great for chaining up participants, such as 1:2:[] and f <$> getLine <*> hGetLine h
00:38 takle joined
00:41 <monochrom> > False == True == False
00:41 <lambdabot> error:
00:41 <lambdabot> Precedence parsing error
00:41 <lambdabot> cannot mix ‘==’ [infix 4] and ‘==’ [infix 4] in the same infix expre...
00:41 papermachine joined
00:41 <monochrom> Oh heh. But it is associative too.
00:42 <ezyang> I'm QuickChecking a function that might raise an exception, but I want the case to pass in this case
00:42 muesli4_ joined
00:42 muesli4 joined
00:42 <ezyang> is there a way to do this?
00:43 markus1209 joined
00:43 <ph88> ezyang, you can use monadicIO with qc
00:43 <ph88> and the Control Exception try
00:44 <monochrom> Ah! Yeah, "try" will convert exception to Either, now you have a cool value to check against.
00:45 <Jello_Raptor> is there a good viewer for .prof files?
00:45 <ezyang> So, how do I say, "OK, skip this case" in that case?
00:45 <ezyang> I guess I could do False ==>
00:45 <ph88> ezyang, qc does not skip afaik, only pass or fail
00:45 <ph88> but maybe when you use MonadicIO you can do some logging on the side
00:46 <monochrom> I don't know QuickCheck, but your property is informally "try myaction should return Left MyException"
00:46 <ph88> but actually with other testing frameworks you can only decide to skip before you perform the test, when it's performing it can only pass or fail
00:47 <MarcelineVQ> Jello_Raptor: https://hackage.haskell.org/package/profiteur possibly, I've not used it
00:47 marcopullo joined
00:47 <ph88> ezyang, https://hackage.haskell.org/package/QuickCheck-2.9.2/docs/Test-QuickCheck-Monadic.html https://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Exception.html#v:try
00:47 <Jello_Raptor> MarcelineVQ: ahh, that's the one I'm installing now, we'll see how well it works :P
00:48 markus1189 joined
00:48 systadmin joined
00:50 sandstorm joined
00:50 <tikhon> Is there an elegant way to write your own function in terms of printf?
00:51 <tikhon> I want to have something like "errorf", but it looks like I'd have to define my own class for it or something.
00:51 <MarcelineVQ> :t ioProperty
00:51 <lambdabot> Test.QuickCheck.Property.Testable prop => IO prop -> Test.QuickCheck.Property.Property
00:51 theDon_ joined
00:52 erisco joined
00:52 <lyxia> tikhon: you mean having errorf fmt x y z = error (printf fmt x y z) ?
00:54 <monochrom> You can reuse printf's classes.
00:54 <tikhon> yes, esactly
00:54 <tikhon> exactly**
00:54 <monochrom> In fact, s/reuse/use/, you can black-box-use them.
00:54 <tikhon> monochrom: I was hoping for that, but I couldn't immediately figure out how to do that.
00:55 <monochrom> OK, I need to pull of printf's doc. What's the package name again?
00:55 JeanCarloMachado joined
00:55 <monochrom> s/pull of/pull up/
00:55 <lyxia> base
00:55 <lyxia> https://hackage.haskell.org/package/base-4.9.1.0/docs/Text-Printf.html
00:59 <monochrom> Ah, I can't pull it off.
00:59 juhp___ joined
00:59 dfeuer joined
00:59 atomi_ joined
01:00 <erisco> almost quotable but I don't think enough people are British
01:02 mac10688 joined
01:04 handyc joined
01:05 JeanCarloMachado joined
01:06 robertkennedy joined
01:07 fDev2179 left
01:08 mda1 joined
01:09 tromp joined
01:09 ramzifu joined
01:10 alx741 joined
01:10 tangled_z joined
01:10 handyc left
01:10 nighty- joined
01:11 StoneToad joined
01:11 jbiesnecker joined
01:11 muesli4__ joined
01:15 bbcue joined
01:15 <tikhon> I wonder what a printf could look like in the eventual dependent Haskell future
01:17 dpren joined
01:17 unknwn1 joined
01:17 dan_f joined
01:18 <lyxia> You can already do a type safe printf with GADTs + QuasiQuotes.
01:18 muesli4 joined
01:19 <tikhon> Hmm, I imagine that would still be awkward to work with.
01:19 <tikhon> If you want to do the errorf thing I mentioned, for example.
01:19 jshjsh joined
01:22 <lyxia> errorf [fmt|%d%s%f|] x y z ?
01:22 <erisco> I have a fun problem
01:23 jbiesnecker joined
01:23 <lyxia> tikhon: do you consider that ^ awkward
01:23 <erisco> I have a set of sets S and a set of n-tuples T
01:24 bodisiw joined
01:24 <tikhon> lyxia: I meant defining errorf in terms of the underlying printf provided by the library would be awkward
01:25 <lyxia> ok nevermind me.
01:25 <Rotaerk> erisco, that DOES sound like a problem!
01:25 Koterpillar joined
01:25 <tikhon> but otherwise it's fine
01:25 <erisco> I want to find the largest set S' = x1*x2*...xn where x1,..,xn ∈ S such that S' ⊆ T
01:25 <tikhon> it is an improvement over the normal printf
01:26 <Jello_Raptor> huh, I wrote a program that is using 2000% of cpu power on our compute box (with many cores) :/ i'm sure I didn't actually tell it to parrelelize anything, where's all that multicore use coming from?
01:26 <tikhon> I think we'd be able to have our cake and eat it to with dependent types—but maybe it would make the types involved to verbose to use.
01:26 <dolio> Jello_Raptor: Garbage collection?
01:27 <erisco> my core are spiking to! are you using a stop-the-world collector?
01:27 <Jello_Raptor> dolio: but that many cores? i thought it generally topped out at 2?
01:28 <dolio> I don't see why it would parallelize, but only use two cores.
01:28 <Jello_Raptor> the GC?
01:29 <dolio> Unless you told it to.
01:29 <erisco> so I can think of a quadratic algorithm that finds all the n-tuples of sets from T
01:29 <erisco> then it selects just those where the sets are from S
01:29 <erisco> then it selects just the largest
01:29 <Jello_Raptor> ahh I'm used to GC from other languages that aren't as parallelized
01:30 <erisco> it always runs in quadratic time
01:32 <erisco> the purpose of this problem is to find a small representation of as many of the elements of T as possible
01:32 FreeBirdLjj joined
01:32 zhigang1992 joined
01:32 <erisco> so it is a lossy simplification
01:33 <erisco> but in context, any element from T will do, I just want to represent as many as I can, so it isn't actually lossy
01:35 blrama joined
01:36 badlands joined
01:37 halogenandtoast joined
01:38 blrama joined
01:41 dan_f joined
01:43 jbiesnecker joined
01:43 vektorweg1 joined
01:43 anuxivm left
01:45 uglyfigurine joined
01:45 kvda joined
01:46 eacameron joined
01:48 Jacoby6000_ joined
01:48 sleffy joined
01:49 RC-3004 joined
01:49 oisdk joined
01:49 acidjnk22 joined
01:49 papermachine left
01:50 benjic joined
01:52 FreeBirdLjj joined
01:52 _sras_ joined
01:53 carlosdagos joined
01:53 drewr joined
01:54 <_sras_> Is there anyway to make a forked thread run in a custom monad?
01:54 bodisiw joined
01:55 <Koterpillar> _sras_: not a general one - how would you handle, for example, StateT?
01:56 c137 joined
01:58 <_sras_> Koterpillar: Because that would let the thread modify state in the parent?
01:58 Scip joined
01:58 <pacak> :t forkIO
01:58 <lambdabot> error: Variable not in scope: forkIO
01:59 <pacak> Hmm...
01:59 <pacak> forkIO :: IO () -> IO ThreadId
01:59 Stanley00 joined
01:59 <pacak> forkIO will spawn a separate thread - in IO monad it will be able to do stuff
02:00 <pacak> Side effects - launch rockets and so on.
02:00 stevebash joined
02:00 <pacak> For state monad... Suppose it will modify some state. What's next?
02:01 <Koterpillar> _sras_: because the effects will need to be linearized somehow
02:01 <pacak> :t par
02:01 <lambdabot> error:
02:01 <lambdabot> • Variable not in scope: par
02:01 <lambdabot> • Perhaps you meant one of these:
02:02 <pacak> lambdabot: Y U SO LAZY?
02:02 <_sras_> pacak: Access the changed state down the line...I guess..
02:03 <_sras_> Koterpillar: linearized mean? made in order?
02:03 mysiticity joined
02:03 <pacak> _sras_: How about Maybe monad?
02:04 FreeBirdLjj joined
02:04 Kallis joined
02:04 modori518 joined
02:04 <Koterpillar> _sras_: let's imagine you've somehow done forkIO $ modify (+ 1)
02:05 <_sras_> pacak: You cannot return the main thread until the forked thread is done...right?
02:05 <Koterpillar> _sras_: will the main thread ever see this effect?
02:05 Kallis joined
02:05 <pacak> _sras_: Riiiiight. So why do we want to fork it in this case?
02:05 <_sras_> pacak: because it need to know if the forked maybe is a Just or Nothing...
02:06 <pacak> And if we are talking about arbitrary monads - they can do lots of strange stuff
02:06 <Koterpillar> if you can provide YourMonad () -> IO (), then do that
02:07 <_sras_> Koterpillar: But I do not want the main thread to see the effect. I want the state to be passed on to the new thread, and the new changes remain local....
02:07 <Koterpillar> then make the function above
02:07 <pacak> get state, forkIO, run state monad inside IO monad
02:07 <Koterpillar> ^
02:08 Quarsi joined
02:08 <pacak> Or look into parallel evaluation strategies
02:08 snowalpaca joined
02:09 ebzzry joined
02:09 xplat joined
02:09 <Quarsi> How can I quote an associated data family for template haskell? I.E, deriveJson ''(X Foo) where I have instance User Foo where; data X Foo = ...
02:10 uglyfigurine joined
02:10 jbiesnecker joined
02:10 <_sras_> pacak: Koterpillar Basically, What I want to do is this. I have a monad stack with a readerT and a loggingT. And I want to send emails from forked threads and want to catch exceptions and log using the LoggingT..
02:10 <Koterpillar> where does the logging go?
02:11 <_sras_> Koterpillar: to a file.
02:11 <pacak> _sras_: That's not arbitrary monad but something specific. You can pass config into forked monad. for loggingT - implement something similar.
02:11 <pacak> Btw, you might not want to write to a file from forked threads
02:12 <_sras_> Koterpillar: I can pass the FastLogger in the reader and make the thread use it to write to the log...
02:12 DataComputist joined
02:12 <_sras_> pacak: Yes. That can be done....
02:13 <_sras_> pacak: Koterpillar btw, I found this https://hackage.haskell.org/package/forkable-monad
02:13 <_sras_> Not sure about using it though...
02:14 <pacak> uploaded 2010, downloads - 566
02:14 <erisco> I am thinking of a function (a -> [a] -> b) -> [a] -> [b] which maps each element together with every other element to a new list
02:14 <pacak> Userbase of 0, 1 download a month?
02:14 benjic joined
02:15 athan joined
02:15 eacameron joined
02:15 <_sras_> pacak: Koterpillar but it does require implementing a ForkableMonad instance...
02:16 xplat joined
02:18 Sornaensis joined
02:19 luigy joined
02:19 threshold joined
02:21 <defanor> what are the recommended libraries to read and modify xml? i'm looking for something simple, maintained, lightweight; not necessarily usable for large files. there's plenty of libraries, hard to pick
02:21 conal joined
02:22 <erisco> ah I think I am interested in list zippers
02:23 Gurkenglas joined
02:23 <erisco> ([a] -> a -> [a] -> b) -> [a] -> [b]
02:23 SSBun joined
02:23 JavaSucksMan_ joined
02:23 <erisco> or you could make that more like a fold than a map as well
02:24 <pacak> every element together with every other element?
02:24 Jackoe joined
02:24 <pacak> sounds comonadish
02:24 <erisco> it is the same as a zipper I realise
02:24 Jackoe joined
02:24 <erisco> it is the same as just mapping the zippers
02:24 <erisco> no experience with comonads
02:25 benl23 joined
02:25 zhigang1992 joined
02:26 <pacak> :t extract
02:26 <lambdabot> error: Variable not in scope: extract
02:26 <pacak> lambdabot: :-P
02:26 <erisco> so I can start with [a] -> [([a], a, [a])]
02:26 <pacak> extract :: w a -> a
02:27 <pacak> list zipper is comonad
02:27 <erisco> that is not implementable for list, so how does a comonad apply here?
02:27 <pacak> http://blog.sigfpe.com/2006/12/evaluating-cellular-automata-is.html
02:28 <edwardk> in that same vein there are these: https://www.schoolofhaskell.com/user/edwardk/cellular-automata
02:28 <erisco> thanks I'll bookmark those
02:28 <erisco> can just rattle off these functions for now though
02:29 <edwardk> Sadly the run button doesn't exist on the school of haskell any more =( it was nice when you could just click on the examples and get images
02:29 <pacak> erisco: I also have a huge list of bookmarks that I should read at some point but never do for some reason.
02:29 xplat joined
02:30 <edwardk> erisco: re it not being implemented for lists you can think of the thing you have there as being take [] -> [] take (a:as) -> and start with a list zipper at that starting point, and run down the list.
02:30 <edwardk> so in the case where you actually _use_ the zipper you know you have a non-empty list... which is also a comonad.
02:30 badlands joined
02:30 stevebash joined
02:31 e14 joined
02:31 <erisco> what is take?
02:31 <edwardk> i was using it a conversational term. the function takes that input and gives that output
02:32 leat joined
02:32 <edwardk> so assuming you have a comonad data Zipper a = Zipper [a] a [a]
02:32 <erisco> I don't follow but I'll read on comonads at some point
02:33 <erisco> Zipper might be a Comonad, sure, it at least gets past extract
02:33 <edwardk> blah _ [] = []; blah f (a:as) = case extend f (Zipper [] a as) of Zipper _ b bs -> b:bs
02:33 <erisco> :t extend
02:33 <lambdabot> error: Variable not in scope: extend
02:33 <edwardk> :t Control.Comonad.extend
02:33 <lambdabot> Control.Comonad.Comonad w => (w a -> b) -> w a -> w b
02:33 <pacak> If you are doing something comonadish using them cam save you some coding.
02:34 <edwardk> now all you have to do is write extend/extract for Zipper =)
02:34 <erisco> I need the laws too
02:34 <pacak> And understand comonads.
02:34 <edwardk> sure, but zipper is a known comonad, so its easy
02:34 <pacak> Like a burrito, but in reverse.
02:34 <erisco> if I copy and paste, sure :P
02:34 Welkin joined
02:34 <erisco> extend looks weird to me
02:34 <edwardk> extract (Zipper _ a _) = a -- is obvious
02:34 <edwardk> extend is trickier
02:35 <pacak> :t Control.Comonad.duplicate
02:35 <lambdabot> Control.Comonad.Comonad w => w a -> w (w a)
02:35 <edwardk> might be easier to think in terms of duplicate
02:35 <pacak> this one
02:35 <erisco> it has more than one implementation and so I need the laws to tell me which ones are valid
02:35 <pacak> comonad
02:35 <pacak> http://hackage.haskell.org/package/comonad
02:37 <edwardk> using http://hackage.haskell.org/package/comonad-extras-4.0/docs/Control-Comonad-Store-Zipper.html its easy to write the thing you want =)
02:38 <edwardk> well, i guess not, i don't expose enough guts
02:38 systadmin joined
02:38 mizu_no_oto joined
02:38 <edwardk> young me was an ass apparently =)
02:38 <pacak> edwardk: Then this library will be forked and maintained by somebody who will expose all the things...
02:39 <edwardk> pacak: go for it. it hasn't been maintained by the jerk who wrote it in 4 years
02:39 <Welkin> edwardk: you have over 200 packages to maintain
02:39 <Welkin> get to it
02:39 <edwardk> only about 130
02:39 <c_wraith> I can't manage to maintain 2
02:39 <edwardk> most of the rest are only on github
02:39 <edwardk> or are in other languages
02:40 <pacak> I have like 2 and they both are outdated compared to internally used versions.
02:43 <edwardk> my secret is for the longest time i always had to ship and update my dependencies to hackage before i'd let myself use the changes internally in another project
02:43 FreeBirdLjj joined
02:43 <erisco> nah I think I can do this more simply or differently with the combinations of length n
02:43 <erisco> there ought to be a package for these operations
02:43 <erisco> combinations and permutations
02:43 <edwardk> erisco: its easy enough to write a manual zip-through the list once operation
02:43 FreeBirdLjj joined
02:44 raycoll joined
02:44 <pacak> edwardk: I'll try that.
02:45 <edwardk> :t let foo = go [] where go _ [] = []; go as (b:bs) = f as b bs go (b:as) bs in foo
02:45 <lambdabot> (FromExpr [t], Typeable t, Typeable a, Show a) => [a] -> [t]
02:45 <edwardk> er
02:45 <erisco> subsequences, just what I was looking for
02:45 <edwardk> :t let foo f = go [] where go _ [] = []; go as (b:bs) = f as b bs : go (b:as) bs in foo
02:46 <lambdabot> ([a] -> a -> [a] -> t) -> [a] -> [t]
02:46 <edwardk> better
02:46 osa1_ joined
02:47 uwap joined
02:49 <edwardk> > let foo f = go [] where go _ [] = []; go as (b:bs) = f as b bs : go (b:as) bs in foo (\before during after -> sum before + sum after) [1,2,3,4,5]
02:49 <lambdabot> [14,13,12,11,10]
02:52 BlueRavenGT joined
02:54 bbcue joined
02:54 {emptyset} joined
02:55 carlosdagos joined
02:57 IRCFrEAK joined
02:58 IRCFrEAK joined
02:59 rekahsoft joined
02:59 wtetzner joined
03:00 hucksy joined
03:03 dfeuer joined
03:06 IRCFrEAK joined
03:06 mac10688 joined
03:06 e14 joined
03:08 eacameron joined
03:08 bjz joined
03:12 Goplat joined
03:13 justan0theruser joined
03:13 xtreak joined
03:15 IRCFrEAK joined
03:20 jbiesnecker joined
03:21 shafox joined
03:22 IRCFrEAK left
03:23 nocturne777 joined
03:27 fakenerd joined
03:28 IRCFrEAK joined
03:28 IRCFrEAK left
03:30 mmachenry joined
03:31 <Welkin> :t flip (const flip const id)
03:31 <lambdabot> (b -> c) -> b -> c
03:31 <Welkin> write your programs with that :O
03:32 <Welkin> (+4) `flip (const flip const id)` 1
03:32 <Welkin> ? (+4) `flip (const flip const id)` 1
03:32 <Welkin> > (+4) `flip (const flip const id)` 1
03:32 <lambdabot> <hint>:1:12: error: parse error on input ‘(’
03:32 <Welkin> > (flip (const flip const id)) (+4) 1
03:32 <lambdabot> 5
03:32 <Welkin> :D
03:33 FreeBird_ joined
03:35 plutoniix joined
03:36 trudyjane joined
03:36 Allonphone joined
03:37 c137 joined
03:38 IRCFrEAK joined
03:38 halogenandtoast joined
03:38 exferenceBot joined
03:40 nomicflux joined
03:41 IRCFrEAK left
03:41 jrm joined
03:41 CoconutCrab joined
03:42 jbiesnecker joined
03:43 hexagoxel joined
03:44 <riaqn> Hello, in GHC core, what's Corecion? What's the difference between Cast?
03:45 plutoniix joined
03:45 kvazau joined
03:46 systadmin joined
03:46 aatxe joined
03:47 trudyjane joined
03:47 Netwolf joined
03:48 <erisco> Gloss looks great for having a simple HTML5 canvas like drawing API
03:48 <erisco> if I wanted to then add shaders, how would I do so?
03:49 <erisco> or is there a more sophisticated drawing library? (other than just straight OpenGL bindings)
03:49 badlands joined
03:49 <Welkin> erisco: you would use love
03:50 <erisco> what is love?
03:50 <Welkin> https://love2d.org/wiki/love.graphics.setShader
03:50 <Welkin> :P
03:50 <Welkin> it's not-haskell
03:51 <Welkin> but if you want to make games, I recommend it
03:51 <erisco> I am not interested in non-Haskell libraries
03:51 <Welkin> haskell just doesn't have great support for games
03:52 <erisco> I am just looking to draw things
03:52 <Welkin> unless you like using raw opengl
03:52 BlueRavenGT joined
03:53 jbiesnecker joined
03:53 <erisco> I am thinking Gloss is just too simplistic for me
03:53 tripped joined
03:54 <srk> just made this with concurrent-output and repline https://asciinema.org/a/108677
03:55 IRCFrEAK joined
03:58 <davean> Welkin: I mean, your other option is raw Vulkan?
03:58 <trudyjane> Is there a Haskell implementaion of a complete SDL for an existing ray tracer? diagrams-povray?
03:58 <MarcelineVQ> riaqn: have a start here https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CoreSynType
03:59 conal joined
03:59 <riaqn> MarcelineVQ: thanks for the link. This link doesn't contain the Corecion constructor.
03:59 <riaqn> which is why I believe it's outdated.
03:59 pera joined
03:59 <MarcelineVQ> "Cast is used for an FC cast expression. Coercion is a synonym for Type."
04:00 <riaqn> MarcelineVQ: https://downloads.haskell.org/~ghc/7.6.3/docs/html/libraries/ghc/CoreSyn.html#t:Expr
04:00 IRCFrEAK left
04:00 <riaqn> I meant the last constructor, Corecion Corecion.
04:00 <riaqn> not Cast (Expr b) Coercion
04:01 Jacoby6000_ joined
04:03 sleffy joined
04:03 <MarcelineVQ> I see, compared to that file the wiki page is out of date
04:04 <MarcelineVQ> idk much about Core unfortunately, CoreSyn seems like a good place to start though and possibly https://ghc.haskell.org/trac/ghc/browser/ghc/compiler/types/Coercion.hs
04:05 IRCFrEAK joined
04:05 IRCFrEAK left
04:05 <riaqn> MarcelineVQ: thanks anyway.
04:06 <erisco> hm, I am checking out luminance
04:06 <MarcelineVQ> Is the haddock page you linked the ghc version you're using?
04:06 <MarcelineVQ> if not the newest stuff is at https://downloads.haskell.org/~ghc/8.0.2/docs/html/libraries/ghc-8.0.2/index.html
04:07 kylefang joined
04:07 dfeuer joined
04:07 kylefang left
04:09 <MarcelineVQ> riaqn: maybe http://bgamari.github.io/posts/2015-01-19-understanding-ghc-core.html
04:09 <riaqn> MarcelineVQ: cool, thanks! Coercion is still in the latest version, though.
04:10 <riaqn> MarcelineVQ: no, this blog only explain the Corecion type, not the Corection constructor.
04:11 <riaqn> MarcelineVQ: maybe I will leave this constructor out until it occurs to me.
04:11 eacameron joined
04:11 <riaqn> I 'm just compiling GHC core to my virtual machine.
04:11 DataComputist joined
04:12 <riaqn> So I can just leave this case out, and see where it comes from when it really appears.
04:12 <MarcelineVQ> riaqn: I'd go ahead and ask about this in #ghc It's not the first place to ask questions but there's a good chance someone there could give you a straight answer to this question
04:13 Xanather joined
04:13 <jle`> oh hey the foldl library has an EndoM
04:13 pasukon joined
04:14 <geekosaur> riaqn, I'd agree this is a #ghc question
04:15 buttons840 joined
04:16 <* geekosaur> is trawling the Commentary to see if it says anything about this, but not having much luck
04:16 <buttons840> is anyone aware of an oauth2 package they would recommend?
04:17 <MarcelineVQ> it's probably covered in one of simon's implementing a compiler papers but idk ^^;
04:21 cyborg-one joined
04:21 sboosali joined
04:21 aarvar joined
04:23 IRCFrEAK joined
04:25 jbiesnecker joined
04:26 beerdrop joined
04:28 <MarcelineVQ> some interesting related stuff here https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/coercible.pdf
04:29 sleffy joined
04:30 otto_s_ joined
04:30 IRCFrEAK left
04:31 plutoniix joined
04:33 heurist joined
04:33 wagle joined
04:34 RageD joined
04:34 tomboy64 joined
04:36 jbiesnecker joined
04:38 shafox joined
04:39 pavonia joined
04:39 takle joined
04:40 <dmwit> riaqn: I have a guess, if you're interested.
04:41 <MarcelineVQ> that paper has a fair bit of jargon I don't follow but it does some coverage of the idea at 4.1
04:41 <dmwit> riaqn: Perhaps something like `foo :: a ~ b => c; foo = ...` sees `foo` get compiled to a function which takes a coercion.
04:42 <dmwit> riaqn: Possibly the caller has fixed `a` and `b`, and so must insert a literal coercion. Then I guess `Coercion` would be used for that.
04:45 <erisco> where did Control.Monad.IO.Class go
04:46 <dmwit> ...nowhere?
04:46 <MarcelineVQ> it's still there, what base do you have?
04:46 <erisco> I don't know, how do I determine my base version?
04:46 raycoll_ joined
04:46 <erisco> https://hackage.haskell.org/package/transformers-0.5.4.0 it isn't listed as a module anymore
04:46 <dmwit> It isn't in transformers. It's in base.
04:46 codafi joined
04:46 <erisco> oh, I guess it is listed as a module, heh, just doesn't have a doc link
04:47 hexagoxel joined
04:47 <erisco> okay then the issue was that the import was predicated with a module name
04:47 <erisco> I mean a package name
04:47 codafi joined
04:48 codafi joined
04:48 castlelore joined
04:48 castlelore joined
04:50 felixsch__ joined
04:50 <MarcelineVQ> erisco: ghc-pkg list | grep base would tell you what base you have, at least at system level. if you're using stack it'll be something like stack list-dependencies | grep base
04:51 <erisco> well damn, bindings-glfw is borked
04:51 mbuf joined
04:51 limlinlo joined
04:51 <erisco> have to get ghc 8.0.2 to fix... =\
04:52 <dmwit> ghc-pkg list base # works fine
04:52 <dmwit> no need to drag grep into this =)
04:53 mmachenry joined
04:53 YellowOnion joined
04:54 Sh4rPEYE joined
04:54 <MarcelineVQ> dmwit: :D
04:54 surtn joined
04:54 mmachenry1 joined
04:54 <erisco> ah ha, 8.0.2 is out
04:55 xplat joined
04:55 carlosdagos joined
04:55 <erisco> they make one modernisation to the linker and the world explodes
04:55 larsan1 joined
04:56 <erisco> legacy legacy legacy
04:56 fakenerd joined
04:56 brynedwardz joined
04:57 <Sh4rPEYE> I wrote a simple Caesar and Vigenere encoder/decoder. Here I posted it on Code Review... Could maybe somebody here look at it and review it? I'm sure it could be twice as short :-D
04:57 <Sh4rPEYE> http://tinyurl.com/mtyhjh6
04:58 <riaqn> geekosaur: MarcelineVQ thx I will try there.
04:59 <kadoban> Sh4rPEYE: flip mod 26 ==> (`mod` 26) also, (+) n ==> (+ n) and flip (-) base ==> subtract base or maybe (`subtract` base), too lazy to figure out which one that is xD
05:00 <Sh4rPEYE> So it is recommended to use the infix over flip?
05:00 <Rotaerk> subtract base
05:01 <dmwit> Sh4rPEYE: It's certainly common. I see nothing wrong with flip.
05:01 <kadoban> For mod, definitely, it reads way better IMO
05:01 unbalancedparen joined
05:02 <kadoban> Sh4rPEYE: Also, your two "helpers" seem very very similar, I'd factor that out
05:02 a3Dman joined
05:02 nepiktaz joined
05:02 <Rotaerk> I don't mind defining functions that are simply flip f, for some other function f, but I think embedding it in a larger, more complicated expression just makes it harder to read
05:02 raycoll joined
05:03 eklavya joined
05:04 <dmwit> Sh4rPEYE: Is `unCaesar` even correct? You are subtracting `base` twice, which seems unlikely.
05:04 <dmwit> Sh4rPEYE: ...and surely you should be subtracting the key, if you're adding it during encoding.
05:05 kvda joined
05:06 marcopullo joined
05:07 Sh4rPEYE_ joined
05:07 <Sh4rPEYE_> It is a little weird, yeah... But it really does work
05:07 dedgrant joined
05:09 <Sh4rPEYE_> What I do is I get the difference between ord 'z' and the char (the first substraction), then add n to it (that is equivalent to substracting n from difference between char and ord 'a'), mod 26, and then substract this final difference from ord 'z'.
05:10 soLucien joined
05:10 Jacoby6000_ joined
05:10 ramzifu joined
05:11 <erisco> little strange that you have to uninstall the haskell platform before installing a new version
05:12 unbalancedparen joined
05:12 <Sh4rPEYE_> What about the Vigenere cipher, could it be done any simpler? I feel there is a way through zip/map/fold that will work straight with words, without first asssigning the letters separately.
05:13 hexagoxel joined
05:13 FreeBirdLjj joined
05:13 <kadoban> Sh4rPEYE_: If it stays like that, "assign" should be done in terms of pattern matching, [] (' ':xs), etc.
05:14 dopey_ joined
05:14 <dmwit> Personally, I think I would write `unCaesar n = caesar (26-n)`.
05:15 <dmwit> I suspect a similar trick ought to be possible with vigenere.
05:15 IRCFrEAK joined
05:17 jre2 joined
05:18 andyhuzhill joined
05:18 Natch joined
05:19 bjz joined
05:20 Vaelatern joined
05:21 splanch_ joined
05:23 slomo joined
05:23 slomo joined
05:23 <MarcelineVQ> "<Sh4rPEYE_> ... I feel there is a way through zip/map/fold that will work straight with words" if you don't care about preserving whitespace you could do something like
05:24 <MarcelineVQ> > unwords . map (map (chr . (+2) . ord)) . words $ "what the heck hmm"
05:24 <lambdabot> "yjcv vjg jgem joo"
05:24 vishalIRC joined
05:24 eazar001 joined
05:26 <MarcelineVQ> oh ehe, you did :> I shoulda read more than just the responses
05:26 ebzzry joined
05:27 <dmwit> Sh4rPEYE_: Oh, another point: `map f (map g xs) = map (f . g) xs`, so `map (map chr) (map (map helper) (words s))` can be `map (map (chr . helper)) (words s)`.
05:27 <MarcelineVQ> just the same it's a little redundant, why map (map chr) instead of ma--- nvm dmwit said it :>
05:28 <dmwit> Sh4rPEYE_: I would be tempted to write something like `onLetters :: Monad m => (Char -> m Char) -> String -> m String` and use it in both `caesar` and `vigenere`.
05:28 <dmwit> `m ~ Identity` for `caesar`, `m ~ State String` for `vigenere`.
05:29 jbiesnecker joined
05:30 osa1_ joined
05:31 halogenandtoast joined
05:32 mhealy joined
05:32 <Sh4rPEYE_> Well, I didn't learn about Monads yet (finishing monoids just now). Will screenshot this, though, and return to it later :-)
05:34 Sh4rPEYE joined
05:38 chewzerita joined
05:38 <Sh4rPEYE> Thank you for the review :-) I'll try to reduce the un- functions and the maps
05:41 jbiesnecker joined
05:42 JagaJaga joined
05:42 HalfEatenPie joined
05:43 FreeBirdLjj joined
05:44 mhealy left
05:44 blrama joined
05:45 doodlehaus joined
05:52 eacameron joined
05:52 chewzerita joined
05:53 Sh4rPEYE_ joined
05:54 chewzerita joined
05:55 <lpaste_> dmwit pasted “simple ciphers” at http://lpaste.net/353874
05:55 <dmwit> Sh4rPEYE_: ^^
05:56 takle joined
05:57 <dmwit> Perhaps `onLetters` can be written as a `mapM`. Let's see.
05:57 <dmwit> :t \f -> traverse (\c -> if isLetter c then f c else pure c)
05:57 <lambdabot> (Applicative f, Traversable t) => (Char -> f Char) -> t Char -> f (t Char)
05:57 <dmwit> Yes, much better.
05:59 <lpaste_> dmwit revised “simple ciphers”: “simple ciphers” at http://lpaste.net/353874
05:59 Swizec joined
06:00 luckymerlin joined
06:02 igniting joined
06:02 <dmwit> I'd be tempted to abstract `intToLetter . (+n) . letterToInt` as well, perhaps as `onInt f = intToLetter . f . letterToInt` or similar. But the big win in my opinion is `onLetters`.
06:02 <erisco> now with 8.0.2 bindings-dsl doesn't compile
06:02 <* erisco> *sigh*
06:02 Sh4rPEYE joined
06:03 Sh4rPEYE_ joined
06:03 <Sh4rPEYE> Oh, that makes me look forward to Monads even more!
06:04 meandi_3 joined
06:04 DataComputist joined
06:04 <erisco> any hints people can give me? http://lpaste.net/353876
06:05 DataComputist joined
06:05 splanch joined
06:05 <erisco> can I install it without docs?
06:06 <dmwit> erisco: It doesn't look like it actually printed any errors.
06:06 <dmwit> Perhaps you can try with -j1 to see if the error is more obvious?
06:07 <dmwit> erisco: Oh, maybe "installed package info from too old version of Cabal (key field does not match id field)" is the error.
06:07 <dmwit> erisco: The documentation warnings are a red herring.
06:07 <erisco> cabal install -j1 bindings-glfw gives the same output
06:07 dminuoso left
06:07 <dmwit> erisco: Possibly cabal install bindings-glfw bindings-DSL --reinstall
06:08 <erisco> hm, nope, same output
06:08 <dmwit> ghc-pkg list bindings-DSL ?
06:09 <dmwit> ghc-pkg check would also be good.
06:09 DataComputist joined
06:09 <erisco> I wonder if the wrong cabal version is being used
06:10 ramzifu joined
06:10 dec0n joined
06:11 <erisco> I am supposed to have the cabal appropriate to 8.0.2 when I install the haskell platform
06:11 <erisco> or so I thought
06:11 eacameron joined
06:14 <erisco> yes it has grabbed the wrong version
06:14 <erisco> for some reason there is a cabal binary in my AppData
06:15 DataComputist joined
06:16 <erisco> now it is happy
06:16 <dmwit> Perhaps you `cabal install cabal-install` at some point in the past.
06:16 mbuf left
06:16 <dmwit> Anyway I doubt it magically became a parser generator; it's probably still cabal and not happy. ;-)
06:17 <erisco> I'm rolling on the floor
06:17 DataComputist joined
06:17 <erisco> in agony
06:17 DataComputist joined
06:18 DataComputist joined
06:20 tromp joined
06:20 govg joined
06:22 xplat joined
06:22 halogenandtoast joined
06:22 dec0n joined
06:22 insitu joined
06:22 oish joined
06:23 _sg joined
06:24 splanch joined
06:24 placidex joined
06:26 clog joined
06:29 danvet_ joined
06:31 certainty joined
06:32 eacameron joined
06:34 hexagoxel joined
06:35 ChaiTRex joined
06:40 DataComputist joined
06:40 Itkovian joined
06:43 louispan joined
06:43 jbiesnecker joined
06:44 ThomasLocke joined
06:44 shayan_ joined
06:45 FreeBirdLjj joined
06:46 ThomasLocke_ joined
06:46 ThomasLocke_ joined
06:47 mda1 joined
06:48 insitu joined
06:48 DataComputist joined
06:49 DataComputist joined
06:50 <adarqui> anyone have a project using ghcjs/building with stack, on ghc 8.0.2 and lts-8.x ? if so, care to share your stack.yaml?
06:50 xplat joined
06:51 Rainb joined
06:52 Itkovian joined
06:53 zar joined
06:55 zariuq joined
06:55 Jacoby6000_ joined
06:55 hvr joined
06:55 hvr joined
06:55 Itkovian joined
06:56 carlosdagos joined
06:59 Einwq joined
06:59 _sras_ joined
06:59 <_sras_> How can I make a stack package without a Main module?
07:00 <adarqui> ya you would specify that in your .cabal file
07:00 ubsan_ joined
07:00 owiecc joined
07:00 <adarqui> use Library instead of Executable
07:00 raichoo joined
07:00 xtreak joined
07:01 eacameron joined
07:03 kritzcreek_ joined
07:03 Rainb joined
07:03 <_sras_> adarqui: There is no Executable section in my cabal file, only one Library section....
07:04 <adarqui> cool, so you don't need a main module in that case
07:04 <adarqui> you just specify your exposed-modules
07:04 <adarqui> anyone here using GHCJS on ghc 8.0.2??
07:05 xplat joined
07:05 <mniip> 4no
07:05 ogrady joined
07:06 <_sras_> adarqui: But I get this error when calling stack build http://lpaste.net/353878
07:08 <adarqui> mniip: thanks. im going to use raw javascript.
07:08 <adarqui> _sras_: post your .cabal file
07:09 insitu joined
07:10 <mniip> good luck
07:10 <adarqui> im not a pro with colors, i just know bold. but yes, i imagine i'll have more luck using raw javascript
07:10 <adarqui> thnx
07:11 <_sras_> adarqui: http://lpaste.net/98610052524408832
07:11 ninegrid joined
07:12 <mniip> adarqui, did not mean to discourage you, just that I can hardly see colors being used in serious discussion
07:12 <adarqui> well i rarely get a response, in any haskell channel i'm in.. so in a last ditch effort, i bolded my question.
07:12 <adarqui> see it from my perspective: everything is always broken
07:13 <adarqui> and you hardly get any help
07:13 <adarqui> if i asked some noob question about the prelude, i'd get 1000 lines of discussion
07:13 <adarqui> all good though
07:14 CurryWurst joined
07:14 biglama joined
07:15 alfredo joined
07:15 <MarcelineVQ> _sras_: odd error, I've no ide why it would suggest that Main at the end, the error is clearly that you don't have a file called LICENSE
07:16 <sm> pretty nifty.. going to bold/underline my questions from now on
07:16 <MarcelineVQ> "Warning: The 'license-file' field refers to the file 'LICENSE' which does not exist." "LICENSE: copyFile: does not exist (No such file or directory)"
07:16 <_sras_> MarcelineVQ: indeed!
07:16 <mniip> adarqui, the state of applied haskell needs a lot of work
07:18 <_sras_> MarcelineVQ: It used to be a Warning usually!
07:19 Wizek joined
07:19 17SAAM0RA joined
07:19 schell joined
07:19 <MarcelineVQ> it is a warning but it tried to copy the file while building which failed
07:20 Fairy joined
07:22 DataComputist joined
07:22 <adarqui> mniip: ya
07:22 insitu joined
07:23 Deide joined
07:24 xplat joined
07:24 DataComputist joined
07:26 <MarcelineVQ> adarqui: my own adventures in having stack and ghcjs play nicely under manual setup haven't gone too well, so I tend to stick to the latest available here https://docs.haskellstack.org/en/stable/ghcjs/ when experimenting with stack+ghcjs there's a repo here for making things yourself with whatever params you need https://github.com/tolysz/prepare-ghcjs
07:27 <adarqui> cool thanks MarcelineVQ .. ya i've tried both. i'm using ghc 8.0.2 and it just can't ghcjs boot, something always breaks
07:27 <cocreature> maybe ghcjs just doesn’t support 8.0.2 yet?
07:27 <adarqui> so was wondering if someone had any specific experience with 8.0.2 and lts 8.x
07:28 <adarqui> cocreature: dno, maybe
07:28 zeroed joined
07:29 <adarqui> 8.0.1 is broken on my osx box so, 8.0.2 works. but i haven't developed my ghcjs app since 7.10.3 (which was building, but failing in the browser due to GHCJS bugs (most likely))
07:29 bjz joined
07:29 fakenerd_ joined
07:30 <MarcelineVQ> well now you've got me curious about this
07:31 eacameron joined
07:31 fakener__ joined
07:32 <cocreature> https://github.com/tolysz/prepare-ghcjs/issues/6 seems relevant
07:33 DataComputist joined
07:34 <adarqui> ya thanks
07:35 CurryWurst joined
07:35 takuan joined
07:35 eacameron joined
07:37 xtreak joined
07:41 nepiktaz joined
07:41 tsahyt joined
07:42 <tsahyt> Hello. I've been looking at the Hoogle API and it seems that the 5.x versions are very incomplete. are they intended to be used already?
07:42 <tsahyt> I'm exploring the possibilities of writing a GUI haddock browser with type search enabled
07:44 dawehner joined
07:45 fizruk joined
07:45 DataComputist joined
07:46 eacameron joined
07:46 zeroed joined
07:47 hexagoxel joined
07:48 Destol joined
07:49 certainty joined
07:50 mgu joined
07:50 Fairy joined
07:51 eatman joined
07:51 xtreak joined
07:53 <MarcelineVQ> tsahyt: it's quite nice to use http://hoogle.haskell.org/ I'm not quite sure what it means about the type-search not working though, something like Monad m => m a -> (a -> m b) -> m b returns exactly what you'd expect
07:54 albertid joined
07:54 <tsahyt> MarcelineVQ: that's a web frontend. I want to write a GTK frontend
07:54 <tsahyt> the problem is that the version >= 5 don't expose any functions to generate a database etc
07:55 jhrcek joined
07:56 FreeBirdLjj joined
07:56 tromp joined
07:57 insitu joined
07:57 takle joined
07:58 Fairy joined
07:58 sword865 joined
07:59 raichoo joined
08:00 <MarcelineVQ> hmm interesting, there's a couple options for that which come to mind, you could call up 'hoogle data' with System.Process or fork hoogle and expose the internals you need like src/Action/Generate.hs
08:00 xtreak joined
08:01 <MarcelineVQ> I'd be more inclined to the latter if you're after tight integration
08:03 <tsahyt> I guess until I make a feature to browser documentation of non-published projects (e.g. for the current one), hoogle generate would be okay
08:03 montagy joined
08:04 <tsahyt> hoogle generate by default now indexes all of stackage as far as I can see
08:04 <cocreature> tsahyt: iirc stack hoogle does that do it might be possible already
08:04 <tsahyt> which covers almost anything I use
08:04 <tsahyt> cocreature: as long as I can get an URL out of it, it'd be usable for my purposes
08:05 <tsahyt> although the query completion feature in 4.2.x looks very interesting too
08:06 <cocreature> development of 4.x is dead so I wouldn’t start building software on top of it
08:06 owiecc joined
08:06 andyhuzhill joined
08:07 unK_ joined
08:08 Yuras joined
08:09 <tsahyt> after playing around with a pre-generated database I think I can make this work for now
08:10 <tsahyt> I want a relatively simplistic gtk interface. a search bar, results in one column with possibly some brief description, full docs in a webkit view in the second column
08:10 DataComputist joined
08:10 <tsahyt> something that is easy enough to use on a touchscreen too, so I can prop up my laptop next to my workstation and flip through docs on a second screen.
08:11 bjz joined
08:11 <tsahyt> from there I could add the option to store offline copies of docs, and so on
08:12 ragepandemic joined
08:12 suls joined
08:13 mattyw joined
08:13 Beetny joined
08:13 DataComputist joined
08:16 guiben joined
08:16 <tsahyt> most importantly though, this all gives me a good excuse to finally make something with gi-gtk and FRP. I've been meaning to do that for a while.
08:17 markus1189 joined
08:17 markus1199 joined
08:17 MoALTz joined
08:18 DataComputist joined
08:20 govg joined
08:20 JuanDaugherty joined
08:22 DataComputist joined
08:23 augur joined
08:23 suls joined
08:26 pylbrecht joined
08:26 markus1189 joined
08:27 raichoo joined
08:27 markus1199 joined
08:31 DataComputist joined
08:33 skapazzo joined
08:34 FreeBirdLjj joined
08:36 connrs joined
08:37 mda1 joined
08:38 henriksod joined
08:38 Prutheus joined
08:39 e joined
08:41 quchen joined
08:42 Scip_ joined
08:45 miniBill joined
08:45 ThomasLocke joined
08:46 <miniBill> is there a nicer/more readable way of writing "ect >>= \ct -> join <$> mapM next ct" ect is of type (Either String (t a)), next is of type (a -> Either String (t b)), and t is a Traversable and Monad
08:46 DataComputist joined
08:47 louispan joined
08:47 Shatnerz joined
08:47 xtreak joined
08:47 spacedog82 joined
08:48 oish joined
08:48 <ezyang> :t forM
08:48 <lambdabot> (Monad m, Traversable t) => t a -> (a -> m b) -> m (t b)
08:48 thc202 joined
08:49 gregman_ joined
08:49 soLucien joined
08:49 DataComputist joined
08:50 BartAdv joined
08:50 Yuras joined
08:51 <miniBill> ezyang: forM is flip mapM, I fail to see how this helps me?
08:51 <riaqn> I give up on compiling GHC core to my virtual machine.
08:51 cinimod joined
08:52 <riaqn> it seems CoreSyn is only for internal use, and not even have Show instance. which makes me analysising harder.
08:52 <riaqn> There was a project called "external Core", but was out-of-sync with GHC for 2 years and finally abandoned.
08:52 cfricke joined
08:52 DataComputist joined
08:53 locallycompact joined
08:53 <ezyang> miniBill: I guess you kind of wnat the EitherT monad transformer
08:54 <ezyang> then bind will do the right thing
08:54 <ezyang> riaqn: The AST is pretty simple though!
08:57 carlosdagos joined
08:57 tromp joined
08:57 ramzifu joined
08:57 PennyNeko joined
08:58 Itkovian joined
08:59 <riaqn> Ez
08:59 <miniBill> ezyang: uhm, but isn't EitherT String m a equivalent to m (Either String a) rather than Either String (m a) ?
08:59 DataComputist joined
09:00 DataComputist joined
09:00 <riaqn> ezyang: you must be kiding.. for the last hour I added dozens of dumb Show instance only to (show Expr).
09:00 <ezyang> oops, yes, I guess you want the other way
09:00 <riaqn> What a backend's author wants is just untyped lambda calculus...
09:01 <ezyang> riaqn: Why don't you use STG then?
09:01 <JuanDaugherty> or try #lisp
09:01 <riaqn> JuanDaugherty: exactly! that's what I plan to turn to.
09:01 <miniBill> ezyang: so I should write and instance for Transforem for my t?
09:02 <riaqn> ezyang: AFAIK, STG has explicit stack?
09:02 <ezyang> miniBill: Well, actually, I guess you can't necessarily do the composition the other way
09:02 <riaqn> while my machine is really pure lambda reduction.
09:02 <ezyang> riaqn: Uh... no?
09:02 <riaqn> ezyang: OK let me check.
09:03 marfoldi joined
09:04 <riaqn> ezyang: a short glimpse tells me that, STG is just Core lower-level, closer to machine.
09:05 freusque joined
09:05 <ezyang> and importantly untyped
09:06 <riaqn> yes that's a good thing. I wish things unrelated to backends striped as much as possible.
09:06 takle joined
09:06 <riaqn> but I worry that the STG data type is still too complex to handle, and more, many GHC's internal references.
09:07 <riaqn> that's uninteresting to me, and potentially hide something that might break my compiler.
09:07 miniBill left
09:07 <riaqn> as much as I hate dynamic typing, for now I guess I have to try..
09:08 FreeBirdLjj joined
09:09 <riaqn> ezyang: BTW, late congratulations on the PhD defense!
09:10 <ezyang> thanks!
09:10 <ezyang> riaqn: So, what are you /really/ trying to do?
09:10 <ezyang> i.e. is this just for fun/learning or do you actually need to get something done?
09:10 <riaqn> ezyang: so I have a untyped lambda reduction machine, and hope to run haskell on it.
09:11 <riaqn> ahh, it's my undergraduate thesis, but it's also fun I think..
09:11 <riaqn> the machine is running on fpga.
09:11 <ezyang> what kind of primitive operations does it support
09:13 <riaqn> communication to outside-world is based on 24bit(or so) integers. The IO is event based.
09:13 ChaiTRex joined
09:14 <riaqn> say there is a buttom on the FPGA, then the program can read the REQ port of that port to check if the bottom's status as changed, read the status of that bottom, and write 1 to ACK port to acknowledge the events.
09:15 <ezyang> I get the feeling that this isn't going to work. Surely your hardware is not implementing a lazy evaluation model, is it?
09:15 <riaqn> ahh, something wrong? it's lazy. But yeah, I feel some stricty is needed to avoid some pitfall related to IO.
09:16 <riaqn> as the primitive operations is not pure.
09:17 <riaqn> The hardware implementation is not hard; the hard part is how to compile pure languages to it while preserving semantics.
09:17 <ezyang> riaqn: So, have you implemented the translator from a dog simple lambda calculus to this arch?
09:18 <ezyang> i.e., the one you'd write in a lambda calculus tutorial
09:18 athan joined
09:19 <riaqn> ezyang: this arch IS lambda calculus.. I would say compile scheme to it requires very very little work.
09:19 merijn joined
09:19 <riaqn> the bytecode(or ISA if you will) IS lambda calculus..
09:19 DataComputist joined
09:19 <ezyang> ok, well, start with a lambda calculus (identity transform) and then start adding features to it
09:20 <ezyang> can you add natural numbers?
09:22 DataComputist joined
09:22 <riaqn> ezyang: yeah that's also waht I'm thinking. start with untyped LC and add typing, polymorphism gradually.
09:22 DataComputist joined
09:23 spatial joined
09:23 <riaqn> ezyang: already has. there is church numbers(of course) and machine integer(24bit)
09:23 <riaqn> I haven't write the verilog code, but have a haskell prototype that runs like a machine(every tail recursion change the argument represetning the states, etc).
09:23 <ezyang> but for most languages typing is not interesting because you just erase the types and you have the same redution semantics
09:24 <ezyang> ok, how about strings?
09:24 <ezyang> and/or heap allocated literals
09:24 free_beard joined
09:25 arpl joined
09:25 hexagoxel joined
09:26 <riaqn> I'm not sure what you means by "heap"... as the machine has no memory other than heap..
09:26 <ezyang> how are you going to represent a constructor
09:26 shncgo joined
09:26 <ezyang> simple example: tuple. Church encode?
09:27 <riaqn> by now just church encoding..I'm not sure if there's any pitfalls.
09:27 ramzifu joined
09:27 nomotif joined
09:27 <riaqn> say, weak-head normal form..
09:28 <ezyang> OK, well, if you still want to use Core, I suggest writing a translator that works with a very small subset of it, and then start adding features
09:28 dawehner joined
09:28 <ezyang> much in the same way you would start with a trivial lisp, and then start adding extra things
09:30 <riaqn> ezyang: well I'm still fighting with trivial things in Core..many hacks, don't know if it worth the time.
09:31 <merijn> Is there any value to using Core? I've thought about this, but afaik it's difficult-to-impossible to feed Core into GHC anyway
09:31 <riaqn> I think I will start with racket or something..
09:32 <riaqn> merijn: yeah, but I'm trying to grab Core out of GHC.
09:32 <merijn> Getting Core out is rather easier, although I don't think the output is very stable across versions?
09:32 <ezyang> the only benefit you get is getting to reuse the frontend
09:33 <riaqn> merijn: that's the point.. Also I don't think it fully preserves the data.
09:33 mkoenig joined
09:33 <merijn> ezyang: Yeah, but the front-end is, to me, the least interesting bit ;)
09:33 <riaqn> ezyang: which is a huge gain! consider the eco-system..
09:33 <merijn> ezyang: I care about not having to reinvent the optimisations :p
09:33 DataComputist joined
09:33 <ezyang> and if I were working with core, I'd use a core2core pass and the GHC API
09:33 <ezyang> well, you'll get that too
09:33 magneticduck joined
09:34 augur joined
09:35 <int-e> riaqn: I actually had a prototype that translated core to lambda calculus... I made it a ghc plugin that just prints the result to stdout.
09:35 <merijn> ezyang: No, I mean in the sense of I'm going to work on a language, it's most likely not Haskell, so the GHC front-end doesn't help, but not having to reinvent an optimising back-end would be nice, but since it's not really possible to feed, e.g. Core into GHC that's not very helpful
09:35 <ezyang> ah
09:36 acidjnk22 joined
09:36 <ezyang> well, if your source language is at all interesting you'll have to do some work to write a desugarer; gotta get the coercions
09:36 <riaqn> merijn: there was a project called "external Core", even this project only concerns "grab Core out of GHC", leaving out "feed core into GHC", because the authors said it's too damm hard.
09:37 jinzhao joined
09:37 <riaqn> int-e: can I have the link?
09:37 <merijn> ezyang: If I believed the kinda stuff I'm interested in doing would be some what easy to retrofit into GHC Haskell, I would just attempt to hack it into GHC directly.
09:37 <merijn> ezyang: But some of the semantics I'd want are sufficiently not-backwards compatible that I don't think that will happen
09:37 <riaqn> merijn: here you go https://downloads.haskell.org/~ghc/6.12.3/docs/core.pdf
09:38 <merijn> riaqn: Right, but grabbing Core out of GHC is something I'm not interested in at all :)
09:38 <riaqn> yeah I understand that, just saying.
09:38 <ezyang> merijn: :^)
09:38 <riaqn> merijn: hmm, but can't you just compile your cool language to haskell?
09:38 <riaqn> if you can..
09:39 <merijn> riaqn: Not in a straightforward way
09:39 <riaqn> OK, I can relate.
09:39 <merijn> So you'd just end up introducing overhead by mismatch between semantics
09:39 bjz joined
09:39 FreeBirdLjj joined
09:39 <merijn> Not to mention I care a lot about the language RTS interaction
09:39 <riaqn> yeah, seriously, there is not a FP backend framework. like LLVM for imperative languages.
09:39 <int-e> riaqn: yes, it's on github anyway: https://github.com/tromp/AIT/blob/master/BLC.hs ... I think it worked with ghc-7.10.2. And the code is quite ugly.
09:40 <merijn> ezyang: I think Haskell is basically the UNIX of programming languages. Good enough to undermine new efforts for a long while
09:40 <ezyang> ...is ML BSD then?
09:40 jinzhao joined
09:40 <merijn> But having just enough obnoxious historical warts to be obnoxious
09:40 <riaqn> merijn: terrific metaphor.
09:41 <riaqn> int-e: thanks.. no hacking is not ugly..
09:41 DataComputist joined
09:41 marr joined
09:41 <riaqn> hmm, as I was saying, no backend framework for FP, like LLVM?
09:41 jinzhao joined
09:42 <merijn> There's a lot of tiny things in the RTS and language semantics that I find really annoying/ugly, but that can't be fixed without some significant breaks in backwards compatibility. And any new language will have a hard time competing with GHC's years of optimisation and ecosystem, so it will probably never take off
09:42 balor joined
09:42 jinzhao left
09:43 ebzzry joined
09:44 Miroboru joined
09:45 refold joined
09:45 iliastsi joined
09:48 jbiesnecker joined
09:48 <int-e> oh how do I turn off the automatic typeable generation...
09:48 alios joined
09:51 <merijn> int-e: I don't think you do?
09:51 <merijn> int-e: Why?
09:52 <ezyang> you can;t
09:52 <ezyang> it goos up core output haha
09:53 <int-e> merijn: Because my plugin gets confused by the generated code. I guess it needs to filter them out.
09:54 t0by joined
09:54 JuanDaugherty left
09:56 <int-e> merijn: It's of no practical consequence, I think. This hack assumes that all code is in a single module with no external references at all. But now there is a reference to a constructor called TyCon (perhaps others) and it gets confused.
09:57 burdges joined
09:58 alfredo joined
09:58 ezksd joined
09:59 balor joined
10:01 Yuras joined
10:01 Koterpillar joined
10:02 xtreak joined
10:03 DataComputist joined
10:03 <Phyx-> "feed, e.g. Core into GHC that's not very helpful
10:03 <Phyx-> "
10:04 <Phyx-> can't you use the API for this?
10:05 Detrumi joined
10:05 tomboy64 joined
10:05 jaspervdj joined
10:06 coot joined
10:07 mekeor joined
10:08 <int-e> merijn: the new thing is that one gets external references even with NoImplicitPrelude and no explicit module imports.
10:09 silentcontrib joined
10:10 <dmj`> Can anyone speak as to how cabal new-build and nix might interact with each other.
10:11 <int-e> riaqn: I added such a filter to my code now, perhaps that's also useful to you.
10:12 locallycompact joined
10:12 ramzifu joined
10:13 DataComputist joined
10:14 Scip joined
10:17 <tsahyt> has anyone here worked with gi-gtk and ListStore?
10:18 MrcRjs joined
10:19 ericsagnes joined
10:19 fizruk joined
10:19 <mekeor> tsahyt: maybe just ask your question
10:20 tester668[m] joined
10:20 <tsahyt> I'm looking for an example that actually works. the constructor takes a [GType] now for columns, and from the examples I can find it looks like this wasn't always the case. those examples just pass a list of some suitable datatype. but of course I get a type error when I try that
10:20 <tsahyt> and with some suitable datatype I mean a custom type for whatever record they want to hold there
10:20 <tsahyt> e.g. https://github.com/haskell-gi/gi-gtk-examples/blob/master/treelist/ListDemo.hs
10:21 <tsahyt> hmm no this examples actually doesn't seem to use gi-gtk to start with
10:22 DataComputist joined
10:22 ramzifu joined
10:22 <tsahyt> maybe it just hasn't been ported yet. anyway, the question remains. GType doesn't have any constructors exposed, so I'm at a loss here on how to construct a [GType] to describe my data columns
10:23 mkoenig joined
10:24 <tsahyt> hmm, gi-gtk-hs provides a nicer API for this. I think I can work from there
10:25 insitu_ joined
10:26 MrcRjs joined
10:28 DataComputist joined
10:30 blrama joined
10:30 phaji joined
10:31 abel-abel joined
10:33 _rht joined
10:34 DataComputist joined
10:34 splanch joined
10:34 HappyEnte joined
10:35 _sras_ joined
10:35 <_sras_> Is there a package that provides a safe version of Text.Printf?
10:36 muppeth[m] joined
10:36 <merijn> A bunch, I think. But more crucially, do you need printf?
10:36 <merijn> _sras_: Or do you just want to format numbers?
10:36 xtreak joined
10:37 DataComputist joined
10:37 <_sras_> merijn: No, not only numbers. Want to interpolate strings...
10:37 rgc joined
10:37 <merijn> I don't know what you mean by that?
10:38 <cocreature> _sras_: there are several libraries. "formatting" seems to be relatively popular. Cale’s category-printf is also cute but probably not used as much
10:38 <merijn> Numeric in base has a ton of stuff for formatting numbers
10:39 <cocreature> I think _sras_ is more looking for something like printf("%s…%s", a, b) rather than just formatting numbers
10:39 <_sras_> merijn: Have to do stuff like "Hello %s" name....
10:39 <_sras_> cocreature: Yes
10:40 <merijn> I tend to just "mconcat" a list of strings for that
10:40 nilof joined
10:40 Itkovian joined
10:40 <Cale> Yeah, I don't even use that library, even though it's actually kinda nice, it's a bit too cute for its own good.
10:40 <yushyin> some of the quasiquoters for text/strings maybe?
10:40 <merijn> mconcat ["Hello ", name, " ", "etc."]
10:40 mbw joined
10:40 <cocreature> usually I do that as well because I’m too lazy to figure out what the printf library du jour is
10:40 <merijn> Or if I want slightly more speed I use ShowS
10:41 <Cale> I also just concat stuff
10:41 <cocreature> but there is some advantage to being able to specify the format string separately. it often becomes easier to see how the final results look
10:41 balor joined
10:41 <merijn> I've used ansi-wl-pprint for pretty coloured output, but that's basically just concat with a bunch of annotation
10:41 <merijn> Now I'm just repeatedly pinging quchen here until he finally releases his stuff ;)
10:44 DataComputist joined
10:44 <_sras_> I usually do Text.concat if I don't have to do it too often...
10:45 <_sras_> yushyin: Do you know a good one. I am looking at the formatting package right now....
10:45 <cocreature> iirc formatting uses some underlying C library which caused problem on windows. not sure if that’s still the case
10:46 <yushyin> yeah the formatting package looks nice but never tried it so far.
10:46 spacedog82 joined
10:47 <merijn> You all should go show some support for my proposal for containers! https://mail.haskell.org/pipermail/libraries/2017-March/027827.html
10:47 kuribas joined
10:47 <merijn> And/or bikeshed names
10:48 Netwolf joined
10:48 <mbw> Hello everyone, I have a question about mtl. Specifically regarding its documentation, or rather lack thereof. If you look for example at https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Except.html , you have a short overview, and some examples further down. That's cool. There's a similar format for ContT, and ReaderT. Alright so far. Now if you look at the pages for WriterT, there is no
10:49 Boomerang joined
10:49 <mbw> information at all, only a link to one of the seminal papers. Most importantly, there is no warning whatsoever about space leaks which might occur when using even the strict version of writer. Did I misunderstand how people are supposed to look up documentation on a fundamental level?
10:49 <Cale> merijn: In fact, practically all of our Maps in projects at Obsidian are newtyped in that way already.
10:49 <merijn> Cale: I know, I've never wanted the current Monoid
10:49 <cocreature> merijn: just make a PR and convince dfeuer to merge it and save yourself annoying discussions on mailing lists :)
10:49 <merijn> Cale: But i think that ship has sailed
10:49 rcat joined
10:49 <Cale> merijn: We have a module Data.AppendMap that works exactly like Data.Map, and exports everything that Data.Map does, except has different instances.
10:50 Netwolf left
10:50 <merijn> cocreature: I would rather have the current instances changed, but I don't think I'm going to win that fight against backwards compatability
10:50 <merijn> Fortunately coerce makes this kinda stuff a lot less cumbersome
10:51 <Cale> Yeah, it's a particularly difficult change, because stuff will still often compile
10:51 <Cale> and just work incorrectlyu
10:51 DataComputist joined
10:51 <merijn> But it seems like a rather uncontroversial change. I dunno why I (or anyone else) hasn't proposed it before
10:51 eatman joined
10:51 <cocreature> people are lazy
10:52 <_sras_> cocreature: Looking at formatting, What is the point of writing `format ("Here comes a string: " % string % " and another " % string)` "Hello" "Hello again"? I could have used the "++" in the place of "%" and got the same result, right?
10:53 <cocreature> _sras_: no string is not a variable containing a string, it’s more like "%s"
10:53 <merijn> cocreature: Hence why I'm going through the effort of proposing it :p
10:53 <cocreature> _sras_: and it is then substituted by "Hello"
10:53 alios joined
10:53 silver joined
10:53 <Cale> Here's a modest proposal: new containers package, moves Data.Map to Map, has the right instances.
10:53 <merijn> Cale: I thought about proposing a new module like that, but in the end I figured simply using 'coerce' whenever I need the monoid is simpler
10:54 <merijn> Cale: Don't think that's going anywhere soon :p
10:54 <Cale> Yeah, the tough thing is that then you need to get everything *else* to support the new Map
10:54 <Cale> and probably bifurcate all other packages
10:54 danza joined
10:54 <_sras_> cocreature: But the I still have to close and reopen quotes, which is what I am trying to avoid...
10:54 <Cale> lol
10:54 <Cale> That's assuming you even succeed
10:55 <cocreature> _sras_: then you need to use some library that relies on TH
10:55 <cocreature> or deal with the fact that it’s unsafe
10:55 plutoniix joined
10:55 <_sras_> cocreature: Yes. TH is fine. Do you have a suggestion?
10:55 psychicist__ joined
10:56 splanch joined
10:56 <lpaste_> abel-abel pasted “Kinds and some type-foo” at http://lpaste.net/353883
10:57 <abel-abel> Hello. I am very confused by the instance definition. Why and How does it make Frank as an instance of Tofu?
10:57 <abel-abel> This example is from here: http://learnyouahaskell.com/making-our-own-types-and-typeclasses#kinds-and-some-type-foo
10:58 <Boomerang> @package interpolatedstring-perl6 -- _sras_ this is pretty good when you have a lot of text
10:58 <lambdabot> http://hackage.haskell.org/package/interpolatedstring-perl6 -- _sras_ this is pretty good when you have a lot of text
10:58 carlosdagos joined
10:58 splanch_ joined
10:58 <cocreature> _sras_: sry no. it hasn’t been sufficiently painful for me to look into TH-based solutions :)
10:58 <Cale> abel-abel: Well, what kind of argument does Tofu have?
10:59 <Cale> abel-abel: i.e. which kind does the type variable t have in that definition?
10:59 <Cale> We see the type signature: tofu :: j a -> t a j
10:59 <abel-abel> Cale: Tofu has a type parameter t. t's kind is * -> (* -> *) -> *
10:59 <Cale> right
11:00 <Cale> So, now what kind does Frank have?
11:00 <abel-abel> Cale: I can understand this.
11:00 <abel-abel> Cale: yeah, frank's kind is the same as t.
11:00 <brynedwardz> @package NeatInterpolation
11:00 <lambdabot> http://hackage.haskell.org/package/NeatInterpolation
11:00 <Cale> right, so at least the instance head is legal: we can write instance Tofu Frank where
11:01 <brynedwardz> oh
11:01 <brynedwardz> @package neat-interpolation
11:01 <lambdabot> http://hackage.haskell.org/package/neat-interpolation
11:01 <Cale> and then we need to define a function tofu :: j a -> Frank a j
11:01 <_sras_> cocreature: Why the hate for TH?
11:01 <Cale> Which as it happens, is exactly the type of Frank's data constructor
11:01 <brynedwardz> I like that one because it doesn't need haskell-src-exts
11:01 tomphp joined
11:02 <Cale> (this is a pretty silly and contrived example... I don't know why the author went with it)
11:02 <geekosaur> _sras_, templating is a lot easier to deal with when it uses the same language (lisp, scheme, etc.) AST swizzling is a pain in the butt
11:02 Snircle joined
11:03 <geekosaur> also TH splices are interpreted so it tends to slow the compile down a lot when used heavily
11:03 <cocreature> _sras_: I don’t hate it but it comes with it’s own set of problems most notably an increase in compile times and the fact that it doesn’t integrate very well with the tooling I use, e.g. hindent can’t indent some weird quasi quoted syntax
11:04 <abel-abel> Cale: you mean the type of Frank's data constructor is the same as the function's type?
11:04 twanvl joined
11:04 <abel-abel> I mean the function tofu.
11:04 <Cale> abel-abel: Yeah
11:05 <abel-abel> I remember value constructor is a function. So here, we just assign Frank's value constructor to tofu function?
11:06 <Cale> Yeah, we define tofu to be Frank
11:08 Rainb joined
11:08 eacameron joined
11:08 pylbrecht joined
11:09 splanch joined
11:09 cpup joined
11:11 <abel-abel> while, I didn't figure out the type of Frank's data constructor is the same as the function tofu's type. In fact, the `b` in Frank is like `j` in tofu; `Frank` is like `t` in tofu. Is that correct?
11:11 osa1 joined
11:11 <Cale> right
11:11 <abel-abel> Cale: Thank you so much!!
11:12 <abel-abel> very helpful to me.
11:13 nepiktaz joined
11:13 tangled_z joined
11:14 bjz_ joined
11:19 zar joined
11:22 DataComputist joined
11:22 oish joined
11:23 DataComputist joined
11:23 <kuribas> Is this considered bad style? myFun x | isNothing y = 0 | otherwise = z+2 where y = myFun2 x; Just z = y
11:23 DataComputist joined
11:23 Decaroj joined
11:23 DataComputist joined
11:24 <ogrady> So I have an AST for a language which consists of Statements, Expressions and other custom structures Foo. The Expressions are nested inside the Statements or Foos. I'd now like to manipulate the expressions - but without ever handling any of the outer Statements or Foos. Is that hard to achieve?
11:24 <kuribas> I find it convenient not to have to nest many case expressions, however the irrefutable matches can crash at runtime.
11:24 DataComputist joined
11:25 DataComputist joined
11:25 <kuribas> In this function case would be cleaner, but I have sometimes many nested case expressions.
11:25 <kuribas> ogrady: use lenses?
11:26 bbcue joined
11:26 <hpc> kuribas: case (a, b) of ...?
11:26 <ogrady> kuribas: never heard of them. Will look into, thanks!
11:26 bjz joined
11:26 <lyxia> | Just z <- myFun2 x = z + 2 | otherwise = 0
11:27 <kuribas> ogrady: https://hackage.haskell.org/package/lens-tutorial-1.0.2/docs/Control-Lens-Tutorial.html
11:27 <kuribas> lyxia: but suppose I have a long list of veriables depending on z in the where statement.
11:27 coot joined
11:28 <cocreature> kuribas: use let instead of where?
11:29 <kuribas> like here http://lpaste.net/353885
11:29 <lyxia> ^.^ this code looks so happy
11:30 <kuribas> that's dot product :)
11:30 pwgn joined
11:30 dawehner joined
11:31 abel-abel joined
11:33 Gloomy joined
11:33 netheranthem joined
11:35 <lyxia> you can define an auxiliary function that takes q3', chop_min, chop_max as arguments and continue after pattern matching there.
11:35 halogenandtoast joined
11:36 <lyxia> do-notation + let works as well
11:37 jbiesnecker joined
11:38 <kuribas> here is the alternative: http://lpaste.net/353885#a353886
11:38 Itkovian_ joined
11:39 <kuribas> lyxia: hm, that may work
11:39 <merijn> kuribas: You can use guards without isNothing
11:40 <kuribas> merijn: how?
11:40 <lpaste_> merijn annotated “No title” with “No title (annotation)” at http://lpaste.net/353885#a353887
11:40 <merijn> Like always, everyone forgets about pattern guards
11:40 <merijn> kuribas: Simply change "| isNothing mbQ3 =" in your guard to "| Nothing <- mbQ3 ="
11:41 JeanCarloMachado joined
11:41 halogenandtoast joined
11:41 <kuribas> merijn: yeah, but I still have the irrefutable pattern...
11:41 <kuribas> Just (chop_tmin, chop_tmax) = chop_interval
11:41 ebzzry joined
11:42 <merijn> kuribas: Where is that used?
11:42 <kuribas> merijn: line 65
11:42 <merijn> kuribas: You can combine pattern guards with the boolean guard
11:43 HoierM joined
11:43 <merijn> ugh
11:43 <merijn> lpaste is slow
11:43 inad922 joined
11:43 <merijn> Slow is apparently an understatement
11:44 <merijn> Any other pastebins that don't suck?
11:44 balor joined
11:44 <geekosaur> depends on how you define "suck". I often use dpaste.de as a fallback
11:44 <brynedwardz> There bpaste.net
11:44 <brynedwardz> There's*
11:45 oisdk joined
11:45 Itkovian joined
11:45 snowalpaca joined
11:45 jomg joined
11:46 <merijn> kuribas: Write something like: http://dpaste.de/dBYc
11:46 muppeth[m] left
11:46 <merijn> kuribas: Then you don't even need the "isNothing chop_interval"
11:48 <kuribas> merijn: I cannot access chop_tmin in the where block.
11:48 <kuribas> merijn: So I still get a nested expression.
11:49 <merijn> So move everything in that where block inside that case
11:50 <kuribas> merijn: how's that different from my annotation?
11:50 <merijn> Write a function in the where block that returns a tuple containing all the tmin, new_tmin, whatever based on chop_tmin/chop_tmax, call that function in the guard, use the values directly?
11:51 mekeor joined
11:52 spacedog82 joined
11:52 mstruebing joined
11:52 dsantiago joined
11:54 zar joined
11:55 Yuras joined
11:57 zariuq joined
11:58 Rizy joined
11:59 balor joined
11:59 <kuribas> I could abuse the continuation monad for a local exit.
11:59 <kuribas> like in C
12:00 lukaramu joined
12:01 Raddamu joined
12:02 nighty- joined
12:02 Boomerang joined
12:04 beckyconning joined
12:05 eacameron joined
12:07 raddamu2 joined
12:09 ziocroc joined
12:10 fakenerd joined
12:10 mvr_ joined
12:11 asthasr joined
12:11 fel-mazo joined
12:11 <kuribas> merijn: I found the maybe monad solved the problem...
12:13 qlkzy joined
12:13 tromp joined
12:14 sepp2k joined
12:14 mekeor joined
12:15 <ogrady> kuribas: Lenses look very promising. But the tutorial only mentions record datatypes. Mine are plain data structures. Is there a way to make Lenses work with them? It compiles just fine but I have no idea what I should then put as argument for "over".
12:15 <kuribas> ogrady: it is easier with record datatypes, but you can construct your own lenses.
12:16 <kuribas> ogrady: Do you know what a traversal is?
12:16 <ogrady> kuribas: Not in detail yet. I've seen it being mentioned in the tutorial though.
12:16 ChaiTRex joined
12:17 <kuribas> ogrady: do you know traverse?
12:17 <kuribas> :t traverse
12:17 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
12:17 Unhammer joined
12:18 tomboy64 joined
12:18 cfy joined
12:18 <kuribas> ogrady: traverse is the general version of mapM
12:18 <kuribas> :t mapM
12:18 <lambdabot> (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b)
12:19 <ogrady> kuribas: I have not until now but skimming through the text looks like it could fit my problem.
12:19 <kuribas> ogrady: traverse performs an action on a part, and returns the whole as an action.
12:20 dawehner joined
12:20 mohsen_ joined
12:20 henriksod joined
12:20 <kuribas> ogrady: a lens does the same
12:21 <kuribas> ogrady: but specialized for your structure.
12:21 <ogrady> kuribas: Alright,
12:21 <ogrady> will look into it, thanks.
12:21 codafi joined
12:22 <kuribas> ogrady: so to create a lens, you need to extract the subpart, perform the action over it, then merge it with the whole.
12:26 ramzifu joined
12:27 <exio4> someone is asking me for books about introduction to functional programming as a concept
12:28 <exio4> which books would you recommend?
12:29 eatman joined
12:30 splanch joined
12:32 fProgrammer joined
12:33 <brynedwardz> exio4: I learned Haskell using haskellbook.com book. It teaches functional programming concepts quite well.
12:33 Axman6 joined
12:34 cfy left
12:34 jbiesnecker_ joined
12:34 <brynedwardz> Here's a free one https://www.gitbook.com/book/drboolean/mostly-adequate-guide/details . I haven't read it and so can't really comment.
12:34 <exio4> brynedwardz: I would like something which aims to be at least a bit language-agnostic
12:34 <brynedwardz> I'm sure there are some people here who'd have better suggestions
12:34 <cocreature> exio4: maybe sicp?
12:35 <fProgrammer> quick Question: I've a hashmap of the form { "textKey" : [ "value", "value2"] } I have to perform operation which requires me to append the value of "textKey" . Simple way is to lookup with "textKey" append the value, and re-Insert. What is the most efficient way to do it?
12:35 <Axman6> what do you mean by 'to append the value of "textKey"'?
12:36 <cocreature> fProgrammer: use "update"
12:36 <cocreature> or "adjust"
12:36 <cocreature> (assuming we are talking about HashMap from unordered-containers)
12:36 <lep-delete> or insertWith
12:36 <exio4> cocreature: yeah, I am adding it
12:36 <exio4> anything extra?
12:36 <fProgrammer> Axman6: append the list, the new value of "textKey" will be ["value", "value2", "vlaue3"]
12:37 <Axman6> yeah, then what cocreature said
12:37 Xanather joined
12:37 mizu_no_oto joined
12:37 <fProgrammer> Axman6: cocreature: Thanks!
12:38 kthnnlg joined
12:40 zar joined
12:41 Wizek joined
12:41 thunderrd joined
12:44 Einwq joined
12:48 Mihai_ joined
12:50 unK_ joined
12:50 gehmehgeh joined
12:58 dawehner joined
12:58 carlosdagos joined
12:59 harfangk joined
12:59 sdothum joined
13:00 <quchen> merijn: ;-)
13:00 bbcue joined
13:00 <quchen> merijn: You can already use it by the way. I include it via git+stack in all my projects. :-)
13:01 <merijn> quchen: Yeah...I'm so curmudgeony I haven't looked at stack at all yet
13:01 systadmin joined
13:01 <merijn> So I don't think that'd work for me :p
13:01 drewr joined
13:01 halogenandtoast joined
13:03 oish_ joined
13:04 dawehner joined
13:05 <cocreature> merijn: cabal new-build makes it a lot less annoying to depend on local projects than the add-source stuff :)
13:05 refold joined
13:05 eschnett joined
13:06 alx741 joined
13:06 <merijn> cocreature: I never had problems with add-source, tbh
13:07 <merijn> I haven't looked at new-build yet either >.>
13:07 <merijn> I'm stubbornly on 7.10 with some cabal from around that time >.>
13:07 <cocreature> heh fair enough
13:08 <merijn> If it works, don't fuck with it ;)
13:09 <cocreature> if it works break it so you don’t get bored
13:10 freusque joined
13:12 zariuq joined
13:12 <merijn> cocreature: I generate enough yak shaving by finding already broken things :p
13:15 Gloomy joined
13:15 wei2912 joined
13:17 cpennington joined
13:18 mmhat joined
13:19 Philonous joined
13:20 inad922 joined
13:20 doodlehaus joined
13:21 mizu_no_oto_work joined
13:21 Darruma joined
13:23 deepfire joined
13:23 h3nnn4n joined
13:24 prkc joined
13:25 andobando joined
13:25 mmn80 joined
13:27 ramzifu joined
13:27 fizbin joined
13:27 <fizbin> How do I get access to stack traces in the ghci that I get when I say "cabal repl" ?
13:28 umib0zu joined
13:29 <lyxia> what stack traces
13:29 <fizbin> These ones: https://simonmar.github.io/posts/2016-02-12-Stack-traces-in-GHCi.html
13:30 <lyxia> have you looked in GHC.Stack
13:30 <fizbin> No, why would I look at accessing the stack programmatically?
13:30 splanch joined
13:31 <lyxia> Okay I don't understand what you're looking for then
13:31 <lyxia> What do you mean by "get access"
13:31 <lyxia> if not programmatically
13:31 <fizbin> I have code that (unexpectedly) hangs. I'd like to type that into the thing I get with "cabal repl", interrupt it with a Ctrl-C , and get a stack trace.
13:31 dankruma joined
13:32 jbiesnecker joined
13:32 taktoa joined
13:32 <fizbin> If I could get the ghci command line cabal uses when it invokes "cabal repl", I'd follow that blog post and append "-fexternal-interpreter -prof" to the command.
13:33 <fizbin> Or if there were some option to cabal to say "also pass these flags to ghci when starting the repl"
13:33 <lyxia> --ghc-options
13:33 jbiesnecker_ joined
13:35 <cocreature> if you run cabal with -v it should also show the command line it uses, but --ghc-options is the right thing to use here
13:35 lukaramu_ joined
13:35 <fizbin> Hrm.
13:35 <fizbin> This does not seem to actually give me stack traces.
13:36 eugenez joined
13:36 insitu joined
13:38 robkennedy joined
13:39 <eugenez> Hello, friends! I need to write a few recursive functions, figured i'd use memoization akin to that in Python, where you have a dict with results, and either return value by key or calculate, append and return said key. I have serious troubled trying to implement that in haskell, since I take it i'd need to make a monad, right? (appending Data.Map with value being a side-effect?) Is there a
13:39 emmanuel_erc joined
13:39 <eugenez> better/standart way? I tried to find one with memoization in map or anythin on https://wiki.haskell.org/The_Fibonacci_sequence but failed as well
13:40 emmanuel_erc joined
13:40 Khisanth joined
13:41 <geekosaur> there are some memoization packages on hackage
13:42 takle joined
13:43 <eugenez> it's just for a codewars challenge, I need something simple
13:43 <kuribas> eugenez: There are many options. You can use lazyness for it, or a fold with a map.
13:43 <kuribas> It depends on the problem./
13:44 ystael joined
13:44 <geekosaur> the Fibonacci one relies on the fact that it's recursively defined in a way that lets you use tying-the-knot to get memoization. you can sometimes define things with a lazy map similarly. but what kuribas said; it will depend on the problem
13:46 <eugenez> Thank you friends!
13:48 cpennington joined
13:48 aragorn joined
13:48 metafoob1 joined
13:50 meba joined
13:51 asmyers joined
13:51 ramzifu joined
13:54 carlomagno joined
13:56 simukis__ joined
13:57 zcourts_ joined
13:57 mada joined
13:58 al-damiri joined
13:58 danharaj joined
13:59 eacameron joined
14:01 systadmin joined
14:01 mmachenry joined
14:02 rekahsoft joined
14:03 zaquest joined
14:04 insitu joined
14:07 dsh joined
14:08 chewzerita joined
14:08 CurryWurst joined
14:08 cinimod` joined
14:10 e14 joined
14:10 mmachenry joined
14:11 `^_^v joined
14:11 `^_^v joined
14:13 eschnett joined
14:15 Destol joined
14:16 <adelbertc> is FlexibleInstances what I want if I need to define an instance for say, Const, partially applied to a *concrete* type? e.g. http://lpaste.net/2870650862408040448
14:16 <adelbertc> and if so are there any caveats with using FlexibleInstances?
14:16 <* shapr> bends a flexible instance
14:16 mada joined
14:17 <adelbertc> hm yeah it could violate coherence
14:17 <merijn> adelbertc: No real caveats to FlexibleInstances
14:18 <merijn> adelbertc: Well, one potential caveats
14:18 <merijn> adelbertc: That instance overlaps with "FileIO (Const a)", but whether you care about that is up to you to decide
14:18 piyush-k` left
14:18 <merijn> adelbertc: It's generally fine, though
14:18 <adelbertc> right
14:18 <adelbertc> seems sketchy in that context
14:18 splanch joined
14:19 <adelbertc> is there a better way to achieve this?
14:19 <adelbertc> or is FlexibleInstances basically the answer
14:19 <merijn> What's FileIO even supposed to do? :)
14:19 <adelbertc> its an EDSL in tagless final style
14:19 <adelbertc> MTL-esque
14:20 <merijn> adelbertc: Incidentally, since FileIO requires applicative I don't think this will work
14:20 <merijn> Since "instance Monoid m => Applicative (Const m)" exits
14:20 doomlord joined
14:20 <adelbertc> right.....
14:20 <adelbertc> hm
14:21 jaspervdj joined
14:21 <merijn> oh, well, I guess it does work, but then why not write either: "Monoid m => FileIO (Const m)" or "Applicative (Const m) => FileIO (Const m)"?
14:22 <merijn> In general this just seems the wrong abstraction?
14:23 <adelbertc> merijn: its increasingly seeming like that
14:24 <adelbertc> this is exactly the kind of discussion i was looking for :-)
14:24 <adelbertc> alright i'm going to stare at this some more
14:24 <adelbertc> thank you for your help :-)
14:25 byte512 joined
14:25 <merijn> adelbertc: What are you actually trying to do? :)
14:25 chlong joined
14:25 dawehner joined
14:25 <merijn> i.e., what's the goal of this EDSL?
14:26 Itkovian joined
14:27 openheavens joined
14:27 <adelbertc> merijn: i want an Applicative-y EDSL where i can interpret it into IO, but also run analysis (via a Monoid lifted into Applicative) on it
14:28 EvilMachine joined
14:29 drewr joined
14:30 deepfire joined
14:31 insitu joined
14:32 lep-delete joined
14:34 oisdk joined
14:34 wraithm joined
14:34 zariuq joined
14:34 locallycompact joined
14:34 <adelbertc> ok yeah im using the wrong tools to solve this
14:36 zargoertzel joined
14:37 halogenandtoast joined
14:38 LKoen joined
14:38 {emptyset} joined
14:39 eacameron joined
14:39 e14 joined
14:39 <fizbin> Can someone tell me why this program hangs? I can't figure out why my relatively straightforward tree to hold statistics seems to be hanging. https://gist.github.com/fizbin/4987735a07a7f47be358c0be70e1f148
14:40 splanch joined
14:40 thunderrd_ joined
14:41 HarveyPwca joined
14:42 augur joined
14:42 theelous3 joined
14:43 ebzzry joined
14:43 bryanlemon joined
14:46 burtons joined
14:47 umib0zu joined
14:47 <Mihai_> What does the symbol >>= mean ?
14:48 <Ferdirand> it's the bind operator
14:48 crobbins joined
14:48 <Wizek> Anyone has experience with RecursiveDo/defining MonadFix instances? Do you think it would be possible/simple/easy to define such an instance for Yesod's `Handler` monad?
14:48 <kuribas> :t (>>=)
14:48 <lambdabot> Monad m => m a -> (a -> m b) -> m b
14:48 <Mihai_> oh, as in monads
14:48 <Mihai_> ok
14:49 _sg joined
14:51 spacedog82 joined
14:53 sea_wulf joined
14:54 <lyxia> Wizek: this one? http://hackage.haskell.org/package/yesod-core-1.4.32/docs/Yesod-Core-Types.html#t:HandlerT
14:56 <lyxia> It's probably the same instance as ReaderT http://hackage.haskell.org/package/transformers-0.5.4.0/docs/src/Control.Monad.Trans.Reader.html#line-187
14:56 <Wizek> lyxia, yes
14:57 esph joined
14:58 Vivek joined
14:58 splanch joined
14:59 roconnor joined
14:59 <lyxia> fizbin: print the tree only up to some depth and see whether it looks correct
14:59 marsam joined
14:59 carlosdagos joined
14:59 moongazer joined
15:00 lukke100 joined
15:01 uglyfigurine joined
15:01 limlinlo joined
15:02 <robkennedy> How would you work with PDFs? Doesn't seem like our ecosystem supports it ATM
15:02 <Cale> What work specifically? There are a lot of external tools you can use.
15:03 <robkennedy> Yeah, it's just text analysis. I could use this to learn ffi
15:03 uglyfigurine joined
15:04 <robkennedy> Is there a higher ffi barrier to entry if I don't know C?
15:04 <robkennedy> *high, not higher
15:04 <Cale> Well, you shouldn't need to know very much about C
15:04 <Cale> But some familiarity with concepts that C programmers would be familiar with, like pointers and memory management would be helpful
15:07 <Wizek> lyxia, Hmm. I tried if it is indeed so trivial: `mfix f = HandlerT $ \ r -> mfix $ \ a -> unHandlerT (f a) r` and even though it typechecked I seem to get a a hangup when I try to run some code with out-of-order bindings in an `mdo`.
15:07 <Wizek> in-order bindings work
15:07 insitu joined
15:07 wnjuwl joined
15:07 sillyotter joined
15:08 <merijn> robkennedy: Depends on how much C you don't know ;)
15:08 <Wizek> lyxia, Does that look like 'the correct' definition to you? Is the hangup to be expected?
15:09 <Wizek> (I don't have much experience with `mdo`. I've heard of it and thought now could be a great opportunity for me to give it a try in a Yesod app)
15:11 pera joined
15:12 sssilver joined
15:12 <lyxia> the definition looks fine
15:12 shayan_ joined
15:13 mfs joined
15:14 drewr joined
15:14 <lyxia> What does your mdo code look like
15:14 guiben joined
15:15 rodrigo joined
15:15 wraithm joined
15:15 <rodrigo> s
15:17 e14 joined
15:18 eklavya joined
15:18 mofasa joined
15:18 jmiven joined
15:19 <mofasa> Is there any way to pass a specific file to `stack test course:doctests` ??
15:19 treehaqr joined
15:19 <mofasa> Like this, but through stack: doctest -isrc src/Course/Monad.hs
15:20 zar joined
15:21 <brynedwardz> mofasa: Maybe `stack exec -- doctest -isrc src/Course/Monad.hs`
15:21 <lyxia> mofasa: --test-argiments="-isrc ..."
15:21 <Wizek> lyxia, Here is a small example https://gist.github.com/Wizek/5958e9c1cb2ccc6c500dd45aff641f04
15:21 <lyxia> mofasa: --test-arguments
15:22 <brynedwardz> lyxia's way seems more proper
15:22 Rainb joined
15:23 snowalpaca joined
15:24 <lyxia> Wizek: runDB $ findOne ... is probably strict in adderEmail
15:24 jship joined
15:25 <lyxia> Wizek: basically mfix/mdo is just a convenient way of constructing data with values that you don't quite have access to yet, but you are not allowed to make the control flow depend on that data, if that makes any sense.
15:26 jbiesnecker joined
15:26 cdg joined
15:27 <mofasa> lyxia: that still runs all the tests
15:27 zar joined
15:28 eschnett joined
15:28 <Wizek> lyxia, makes sense, while a bit disappointing
15:29 fizruk joined
15:29 <Wizek> lyxia, I hoped I could just throw bindings in as a soup and the compiler would decide which order is the best to take :)
15:30 <lyxia> mofasa: I guess that does nothing if your main is simply main = doctest [...] with a fixed list of arguments.
15:31 <lyxia> Wizek: I think that wouldn't need mfix, if it were possible.
15:31 refold joined
15:32 uglyfigurine joined
15:32 Lord_of_Life joined
15:34 Rodya_ joined
15:36 jbiesnecker joined
15:37 zariuq joined
15:37 Eduard_Munteanu joined
15:37 Gurkenglas joined
15:37 trism joined
15:39 openheavens joined
15:39 urodna joined
15:39 oish joined
15:41 etehtsea joined
15:41 insitu joined
15:41 JeanCarloMachado joined
15:42 insitu joined
15:43 Gurkenglas_ joined
15:45 <phz_> hi; I’m trying to run tests with stack but it seems it just builds them
15:45 mu_ joined
15:45 CoconutCrab left
15:47 sssilver joined
15:49 insitu joined
15:49 sssilver joined
15:51 <gargawel> (Probably) stupid question: what is the functor instance used by fmap in, e.g., fmap id read ?
15:51 <gargawel> (Granted, that's not something you'd like to do, just wondering)
15:51 <brynedwardz> :t read
15:51 <merijn> :t read
15:51 <lambdabot> Read a => String -> a
15:51 <lambdabot> Read a => String -> a
15:51 <merijn> gargawel: 'Functor ((->) String)' :)
15:52 <merijn> Or, more specifically "Functor ((->) a)"
15:52 <mauke> (e ->)
15:52 <gargawel> merijn: Oh, right. Thanks :)
15:52 <merijn> :t fmap even
15:52 <lambdabot> (Integral a, Functor f) => f a -> f Bool
15:52 <merijn> :t fmap even `asAppliedTo` read
15:52 <lambdabot> (Read a, Integral a) => (String -> a) -> String -> Bool
15:53 vishalIRC joined
15:54 <gargawel> Don't know why I was confused
15:54 <brynedwardz> phz_: Are you using the default stack template?
15:55 <phz_> brynedwardz: no
15:55 <Sornaensis> :t asAppliedTo
15:55 <lambdabot> (a -> b) -> a -> a -> b
15:56 jmelesky joined
15:58 umib0zu joined
15:58 balor joined
15:58 <QRealm> http://lpaste.net/353893 Hey guys, is there anyway to write the last line of this snippet without parens? I've been trying a bunch of combinations of (.) and ($) but nothing's worked out lol
15:59 serendependy joined
16:00 <lyxia> QRealm: return $ words2sample . words <$> lines content
16:00 fakenerd joined
16:00 <glguy> words2Sample . words <$> lines <$> readFile s
16:00 <glguy> words2Sample . words . lines <$> readFile s
16:00 <glguy> err, almost
16:01 <QRealm> so the <$> replaces the map call yes?
16:02 nycs joined
16:02 plutoniix joined
16:02 <lyxia> one of them does
16:02 sea_wulf joined
16:04 jbiesnecker joined
16:04 Itkovian joined
16:04 limlinlo joined
16:07 e14 joined
16:07 insitu joined
16:08 conal_ joined
16:09 <fizbin> lyxia: That suggestion (to print the first several top levels of the tree) eventually helped me find my error. Thanks
16:11 jao joined
16:12 <phz_> is there a known abstraction to have short-circuiting fold in a way that I get a tuple (b, [f]) as result?
16:12 <phz_> like
16:12 Itkovian joined
16:12 Sonolin joined
16:12 <phz_> oh I guess it’s some kind of unfold?
16:12 <mpickering> What techniques do people use to generate API bindings? Do you literally write a program which downloads the specification and uses HSE or something to print out the right source code?
16:14 <thoughtpolice> mpickering: IME you don't even need HSE depending on what you're doing. But yes, it's usually something like that - amazonka, gogol, and 'gl' all do something of this variety.
16:14 raichoo joined
16:14 owiecc joined
16:14 <tsahyt> has anyone here used the webkitgtk webview widget? I want to go to a certain anchor in a page directly. e.g. example.com/#anchor. instead it loads example.com. It works just fine for links.
16:14 <thoughtpolice> amazonka and gogol in particular are massive and almost entirely generated, from my understanding, with some by-hand tweaking. It seems to work pretty well.
16:15 isd joined
16:16 <merijn> What's the flag to allow scientific notation for integers?
16:16 Vzox01 joined
16:16 <glguy> NumDecimals extension
16:17 <merijn> thanks
16:18 <mpickering> thanks thoughtpolice
16:18 mojjo joined
16:19 <thoughtpolice> mpickering: Is this for Phab?
16:19 <mpickering> yes
16:19 zero_byte joined
16:19 Lord_of_Life joined
16:20 descender joined
16:21 Fairy joined
16:21 mson joined
16:22 e14 joined
16:25 peterbecich joined
16:26 dmwit_ joined
16:26 dawehner joined
16:27 robotroll joined
16:28 hs428 joined
16:28 Lord_of_Life joined
16:28 Lord_of_Life joined
16:29 guiben joined
16:30 osa1 joined
16:30 osa1 joined
16:31 guiben joined
16:31 Fairy joined
16:31 splanch joined
16:33 danza joined
16:37 alfredo joined
16:39 hackebeilchen joined
16:39 unK_ joined
16:43 augur joined
16:43 sigmundv_ joined
16:44 sleffy joined
16:44 kthnnlg joined
16:44 {emptyset} joined
16:45 Elish joined
16:46 fiddlerwoaroof joined
16:46 dan_f joined
16:47 lavalike joined
16:49 etehtsea joined
16:49 melop joined
16:51 zar joined
16:52 biglama joined
16:53 augur joined
16:55 tangled_z joined
16:57 zariuq joined
16:59 nitrix left
16:59 mmachenry joined
16:59 <tsahyt> is there a way to generate a hoogle (5) database directly against a stackage snapshot?
17:00 carlosdagos joined
17:01 <hs428> tsahyt: I think `stack hoogle` is what you want (https://github.com/commercialhaskell/stack/issues/55)
17:01 <tsahyt> is that for hoogling in the current project? What I need is a hoogle database that contains URLs of exact versions of packages, rather than against the general hackage page
17:02 <tsahyt> e.g. "https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html#v:map" rather than "https://hackage.haskell.org/package/bytestring/docs/Data-ByteString.html#v:map"
17:02 pera_ joined
17:02 <tsahyt> stackage snapshots are just one way to get that
17:03 boombanana joined
17:03 Zialus joined
17:04 tommd joined
17:05 Jacoby6000_ joined
17:06 HoierM joined
17:12 funkshun joined
17:13 peterbecich joined
17:13 peterbec` joined
17:14 deepfire joined
17:14 _sras_ joined
17:14 <_sras_> Is there an easy way to run the application after a stack build command?
17:14 zv joined
17:14 ragepandemic joined
17:14 <thoughtpolice> stack exec -- name-of-exe <args>
17:14 <tsahyt> shouldn't the -- go after name-of-exe?
17:15 jbiesnecker joined
17:16 <_sras_> thoughtpolice: The problem is that often I don't know the name of exe!
17:17 <Tritlo> run (pure 1 2)
17:17 <Tritlo> lambdabot: run (pure 1 2)
17:18 Noldorin joined
17:18 <Sornaensis> is bottom a member of a void datatype
17:19 <JavaSucksMan_> I'm a haskell noob... is there any reason to use cabal, or should I just learn stack?
17:19 jomg joined
17:20 <isd> (I actually have the opposite question -- I'm still not clear on what problems stack is trying to solve)
17:21 sssilver joined
17:21 <thoughtpolice> tsahyt: No, because 'stack exec' has to have its arguments separated from the executable's (.e.g 'stack exec foo --bar' is somewhat ambiguous as to whether it applies to 'stack', 'exec' or 'foo')
17:21 <tsahyt> thoughtpolice: but the name of the executable *is* an argument to stack
17:21 <thoughtpolice> _sras_: Uhhh, I don't know about that, then? Look in .stack-work and find the name? Why wouldn't you know it ahead of time?
17:21 <isd> JavaSucksMan_: I believe stack builds on top of cabal, so it's not an either/or thing.
17:22 <tsahyt> hence stack exec myexe -- <arguments to my exe>
17:22 <tsahyt> worked perfectly fine for me all this time
17:22 kshukla joined
17:23 <thoughtpolice> tsahyt: The '--' means "Do not interpret any further --flags as going to stack", so it doesn't matter where you mention it, really. It's only to fix that ambiguity. But the -- separates it cleanly in any case.
17:24 <thoughtpolice> So you can use either. I suppose both cases are equivalent unless your executable started with a hypen or + or something ambiguous (which is legit in unix but probably extremely unlikely)
17:26 owiecc joined
17:26 significance joined
17:26 Gurkenglas_ joined
17:26 <significance> Hey all!
17:26 <mmachenry> Hey!
17:26 <_sras_> thoughtpolice: I often does not know what 'exactly' it is...unless I look it up in the .cabal file, right?
17:26 <_sras_> even then there is some suffix involved..
17:27 <thoughtpolice> _sras_: Yes, you'll need to look in the .cabal file for the name of the executable, specifically the 'executable <name>' stanza. (In theory you should just be able to grep for this over every .cabal file)
17:27 <thoughtpolice> something like, `find . -type f -iname '*.cabal' | xargs grep "$executable "` or something
17:27 vydd joined
17:27 vydd joined
17:28 <mmachenry> I want to make changes to a particular record in an imperative context. So I made a chain of monad transformers to model the effects I want. I now want to add nondeterminism, with ListT but I'm getting really confused. Anyone know what's going on? http://lpaste.net/353896
17:28 <significance> If I'm implementing, say, [] as a functor, is it possible to have different implementations based on the type of the contents? i.e. give [Int] and [Char] different fmaps?
17:28 <thoughtpolice> _sras_: In general you should just be able to use the name, but you may need to disambiguate if two packages have the exact same executable name. I'm actually not sure how to do that with stack.
17:28 <thoughtpolice> There shouldn't be any necessary suffixes; even on Windows you don't need to mention .exe
17:28 <S11001001> significance: no, it's not possible
17:28 <mmachenry> Basically I'm trying to take an input game state, and crawl through branching possibilities of outcomes for the next state in a random context with log output of what happened.
17:29 <significance> S11001001: thanks!
17:29 <_sras_> thoughtpolice: I was under the impression the executable's name came from the `name` key in the cabal file + '-exe'...
17:29 cdg joined
17:29 jbiesnecker joined
17:30 <isd> Is there a concrete description of what the problems with cabal are that stack was intended to solve? All I've found is "people found cabal frustrating, so we made another thing!"
17:30 <Cale> significance: A consequence of that is that you only need to check that fmap id = id, and fmap (f . g) = fmap f . fmap g is then implied by parametricity.
17:31 <thoughtpolice> _sras_: No, the executable name is always determined by the 'executable' stanza. A single cabal package could have multiple executables, after all, so that would not work, unless you used the name in the stanza as part of the name of the .exe
17:31 <Phyx-> isd: stack still uses cabal afaik, I guess you mean cabal install
17:31 kappter joined
17:31 <significance> Cale: ahh, that's awesome! How is the latter term implied by parametricity though?
17:31 e14 joined
17:32 Solar123 joined
17:32 <hvr> isd: here's a description of problems: https://www.well-typed.com/blog/2015/01/how-we-might-abolish-cabal-hell-part-2/
17:32 <Solar123> Hi
17:33 JeanCarloMachado joined
17:33 <hvr> isd: the problem was rather that fpcomplete didn't want to contribute to cabal (for reasons they state on their blog), and rather invent their own thing
17:33 <Cale> There's a paper about it called "Theorems for free!" by Phil Wadler.
17:33 <shapr> but the paper costs money
17:33 <shapr> ok ok, I'm joking
17:33 peterbecich joined
17:33 <significance> hahahaha
17:33 <significance> Cale: thanks!!
17:33 <Cale> https://people.mpi-sws.org/~dreyer/tor/papers/wadler.pdf
17:33 <isd> hvr: thanks for the link.
17:34 <Cale> @free map
17:34 <lambdabot> g . h = k . f => $map g . map h = map k . $map f
17:34 <shapr> Solar123: hi! enjoying the sunlight of Haskell?
17:34 zero_byte joined
17:34 <Solar123> Yeah... Thanks😊
17:35 <shapr> Solar123: written any cool code? have some questions?
17:35 <Solar123> Umm.. Are u know the other active channel?
17:36 <hvr> isd: for completeness, here's the blogpost going into the details why they didn't contribute to cabal: https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal -- however, given http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html it's rationale doesn't hold up that well anymore
17:36 <shapr> I think this is the most active channel for Haskell programming.
17:36 <Cale> significance: It's possible to mechanically compute a free theorem for a polymorphic type, which the @free command in lambdabot does.
17:36 ragepandemic joined
17:36 <significance> Cale: whoa. That's incredible -- I'll have to do some wikipedia digging
17:36 <Solar123> Oh.. I see
17:37 fabianvf left
17:37 dawehner joined
17:37 <Solar123> Im noob of irc. Lol
17:37 <Cale> significance: It all breaks down if you allow polymorphic functions to act differently at different types though.
17:37 replay joined
17:37 <significance> Cale: that's so cool! Does Haskell provide any way to write polymorphic functions which act differently based on type?
17:38 <Cale> Well, that's basically what type classes give you
17:38 <thoughtpolice> Cale: Object.toString is the greatest method of all time.
17:38 aarvar joined
17:38 wraithm joined
17:38 <Cale> Only in the case of fmap...
17:38 <Cale> :t fmap
17:38 <lambdabot> Functor f => (a -> b) -> f a -> f b
17:39 <Cale> Only the f type variable is constrained by a type class, so we still get parametricity for a and b
17:39 fresheyeball joined
17:39 <significance> Cale: but we can't do it in the case of the parameter to a type constructor that implements functor, right?
17:39 <tsahyt> what would I need to delete to purge all the accumulated stack snapshots on my system?
17:39 <tsahyt> just ~/.stack?
17:39 wtetzner joined
17:39 <Solar123> Hi Cale
17:40 <Cale> significance: Well, you can't change how fmap works for different choices of the type 'a' or 'b' in the above.
17:40 JuanDaugherty joined
17:40 <Cale> significance: however, if you have an additional type parameter which is effectively part of the 'f', then you might decide to write separate instances
17:40 JuanDaugherty left
17:41 <significance> Cale: ahh, gotcha -- and that would preserve parametricity within each instance, right?
17:41 <Cale> yeah
17:41 <significance> sweet! this is so cool!
17:41 <Cale> (That's still uncommon in practice though -- usually if there's going to be a Functor instance, it's nearly always unique)
17:41 vlatkoB joined
17:42 <significance> Cale: awesome -- thanks so much! I'm pushing through LYAH rn, any suggested reads afterward?
17:42 ikke joined
17:43 <Cale> Depends on what sorts of programs you want to write, but Simon Marlow's book on concurrency and parallelism in Haskell is really good.
17:44 <Solar123> Hi ikke
17:44 <significance> Cale: awesome -- I'll give that a read. For practice, is there any good set of exercises online to get started?
17:44 <Cale> With respect to Haskell specifically, I'm not sure.
17:45 <Cale> It was quite a long time ago when I was first learning now :)
17:45 <significance> Haha -- well thank you for your time! That's a huge help :)
17:45 <Cale> Feel free to continue asking questions as they come up :)
17:45 <Sornaensis> Cale: does the void datatype contain bottom
17:45 <Sornaensis> does that even make sense
17:46 <Cale> Yes
17:46 <Cale> It's unavoidable in Haskell, since we have general recursion
17:46 mkoenig joined
17:46 <Cale> So you can still write fix id :: Void
17:46 <Sornaensis> general recursion = a function can reference itself?
17:46 <Cale> yeah
17:46 <Sornaensis> :t absurd
17:46 <lambdabot> Void -> a
17:46 <Sornaensis> lol
17:46 <Cale> :t fix id
17:47 <lambdabot> a
17:47 <Sornaensis> cool
17:47 <Cale> :t error "Or there's this..."
17:47 <lambdabot> a
17:47 <Sornaensis> what is the purpose of Data.Void
17:47 <Sornaensis> other than being spooky
17:47 jbiesnecker joined
17:47 uglyfigurine joined
17:47 <Cale> Sometimes you want to indicate that you don't believe there ought to be something there.
17:47 Glooomy joined
17:48 <significance> What is the "natural map" $map?
17:48 int-index joined
17:48 maarhart joined
17:49 e14 joined
17:49 <int-index> I need to put `forall m . MonadReader r (trans m)` into my instance context. What's the best workaround? Could pass a Dict, but it's boxed so imposes a performance penalty
17:49 Swizec joined
17:50 <Cale> significance: Well, it's just map itself, though when @free reports the theorem, it's important to realise that it was treating map as an arbitrary function having type (a -> b) -> [a] -> [b], while when it says $map it *really* means the map function.
17:51 <Cale> Might be clearer if we asked it a bit differently:
17:51 <Cale> @free f :: (a -> b) -> [a] -> [b]
17:51 <lambdabot> h . k = p . g => $map h . f k = f p . $map g
17:51 <significance> the => is implication, right?
17:51 <Cale> So, any function f having this type will have that property, with $map referring to the usual map function on lists.
17:51 <Cale> yeah
17:51 <significance> whoa -- awesome, thanks!
17:52 <Solar123> Hey Cale..
17:52 <significance> so @free gives you the free theorem for a type?
17:52 <Solar123> Can u answer me?
17:52 <Sornaensis> @free f :: a -> b
17:52 <lambdabot> h . f = f . g
17:52 tommd joined
17:52 <Sornaensis> @free f :: Just a -> a
17:52 <lambdabot> g . f = f . $map_Just g
17:52 <Cale> Solar123: Sorry...
17:52 mkoenig joined
17:52 wraithm joined
17:52 Mon_Ouie joined
17:52 <Cale> Solar123: Did you ask a question? I might've missed it
17:52 <Solar123> I have to ask some question
17:53 <significance> @free Int
17:53 <lambdabot> Try `free <ident>` or `free <ident> :: <type>`
17:53 <significance> @free f :: Int
17:53 <lambdabot> f = f
17:53 <Sornaensis> @free filter
17:53 <lambdabot> $map f . filter (g . f) = filter g . $map f
17:53 <Cale> significance: You probably meant Maybe a -> a there
17:53 <Sornaensis> @free f :: Maybe a -> a
17:53 <lambdabot> g . f = f . $map_Maybe g
17:54 <significance> Does @free give us any free theorem about <ident>?
17:54 <Cale> <ident>?
17:54 roconnor joined
17:54 <Cale> @free id :: a -> a
17:54 <lambdabot> f . id = id . f
17:54 <significance> the parameter to @free?
17:54 <Cale> ah
17:54 <significance> @free id
17:54 <lambdabot> f . id = id . f
17:54 <Cale> If you just give it a name, it looks up the type of that thing, and then gets you the free theorem for that type
17:55 <Solar123> Hey. Are u know more active channel? Anyone?
17:55 <significance> Cale: is there always just one free theorem?
17:55 <Cale> yeah
17:55 <Cale> Solar123: What about?
17:55 <significance> Solar123: this seems pretty active to me :) how come?
17:55 <Sornaensis> @free f :: (b -> Maybe (a,b)) -> b -> [a]
17:55 <lambdabot> $map_Maybe ($map_Pair h g) . k = p . g => $map h . f k = f p . g
17:55 alfredo joined
17:55 mizu_no_oto_work joined
17:56 <Solar123> About anything
17:56 <significance> Solar123: #freenode is often pretty active
17:56 <significance> also, #programming
17:56 <Cale> Solar123: Most IRC clients have a way of listing channels and getting a count of members in them
17:57 <Solar123> I just want to know about tech channel
17:57 uglyfigurine joined
17:57 jbiesnecker joined
17:57 <Cale> Solar123: There are over 10000 IRC channels with at least 5 people in them.
17:58 <Cale> and 702 of them have 100 people or more
17:58 <Cale> On just this network
17:58 peterbec` joined
17:58 <Solar123> Yeah thanks, but can u tell me the one active channel?
17:58 <Cale> ...
17:58 <Cale> You'll have to pick a topic you'd like to talk about
17:58 <significance> Solar123: If you want general discussion, #freenode works
17:59 <Cale> Try #freenode given that you seem interested in talking about IRC itself
17:59 <Solar123> Yeah. That its
17:59 <Solar123> Thank man
18:00 <lyxia> int-index: I think the Data.Constraint.Forall module is the best there is at the moment.
18:00 conal joined
18:00 <Sornaensis> @free f :: a -> a
18:00 <lambdabot> g . f = f . g
18:00 <int-index> lyxia: it won't work, `m` isn't the last parameter here
18:01 <int-index> I'd need a sort of `Compose` but for constraints
18:01 <significance> Is it hard to derive g . f = f . g for a -> a as a free theorem?
18:01 <significance> Doesn't that mean that function application is commutative for a -> a?
18:01 <int-index> Then I could write `Forall (Compose (MonadWriter w) trans)`.
18:01 <significance> What if I have g x = 2 * x and f x = x + 1? Those (afaik) don't commute
18:02 <eschnett> int-index: you could create a new typeclass for the constraints, then use that typeclass
18:02 <lyxia> int-index: ForallF (MonadWriter w) trans ?
18:02 travisr joined
18:02 <int-index> lyxia: Thanks, ForallF seems to be what I want.
18:02 <significance> @free f :: [a] -> [a]
18:02 <lambdabot> $map g . f = f . $map g
18:02 pasukon joined
18:03 nmdanny joined
18:03 twanvl joined
18:04 <eschnett> significance: if your signature is a -> a, then you can’t multiply by 2, since the Num constraint is missing
18:04 peterbec` joined
18:04 justan0theruser joined
18:05 <eschnett> significance: so the only function left is id :: a -> a, apart from undefined etc.
18:05 <significance> eschnett: ah, thank you
18:05 <significance> @free :: (Num a) => a -> a
18:05 <lambdabot> Try `free <ident>` or `free <ident> :: <type>`
18:06 <significance> Does Wadler's algorithm not work with type constraints?
18:07 <lyxia> @free f :: Num a => a -> a
18:07 <lambdabot> Extra stuff at end of line
18:07 <significance> huh
18:07 <lyxia> probably not
18:08 connrs joined
18:08 silver_ joined
18:08 vishalIRC joined
18:08 <lyxia> it becomes pretty tricky if you start assuming non-trivial structure about a.
18:08 <significance> lyxia: sweet! I'll probably have to dive through Wadler after LYAH :)
18:09 <lyxia> @free f :: a -> (a -> a -> a) -> a -> a
18:09 <lambdabot> (forall y. g . h y = k (g y) . g) => g . f x h = f (g x) k . g
18:09 <significance> when we write `instance Functor [] where...`, for instance, we're having a type constructor implement a typeclass, right?
18:10 Berra joined
18:10 moop joined
18:10 <glguy> type constructors always implement type classes. Without special extensions instances are always for type constructors applied to zero or more type variables
18:10 <glguy> instance Show Int; instance Functor (Either e); etc.
18:11 <significance> glguy: ahh, so Int is a type constructor of zero variables
18:11 <glguy> being a type constructor doesn't have to do with kinds
18:11 <glguy> so basically yes
18:11 <significance> ahh, now I'm following -- thanks!
18:12 Rodya_ joined
18:12 mstruebing joined
18:12 ertesx joined
18:13 mizu_no_oto_work joined
18:13 anton__ joined
18:14 mmn80 joined
18:15 <nmdanny> Is it possible, with arrows, to pass the values inside a case expression pattern to other arrows?
18:15 maarhart joined
18:15 dawehner joined
18:16 vishalIRC joined
18:16 wraithm joined
18:16 <mmachenry> Anyone know how I should add lists to this monad transformer to model branching game states? I
18:16 <mmachenry> I'm having a lot of trouble figuring this out http://lpaste.net/353899
18:17 henriksod joined
18:17 xinming joined
18:18 <mmachenry> Adding ListT to the outside of the transformer chain gives me type errors. Making it just a list [Effect ()] seems like an awkward thing to do since I want to be able to operate on a list of them naturally with the other operations.
18:18 funkshun joined
18:19 <lyxia> nmdanny: with ArrowChoice you can do some pattern matching on values
18:20 <lyxia> it's much convenient than monads though
18:21 <nmdanny> Yes, but when pattern matching on a value, I can't refer to that body inside the match body
18:21 <shapr> I'm parsing tshark output and I can handle "call-id time_relative sip.method" but sometimes it gives me "call-id1,call-id2 time_relative sip.method1,sip.method2" Is there an easy way to restructure my megaparsec parser to handle that?
18:21 insitu joined
18:21 drewr joined
18:21 Twey joined
18:21 b4ff3r joined
18:21 Itkovian joined
18:21 <geekosaur> depends. if you broke out the components into sub-parsers it's relatively easy to fix those subparsers
18:22 <geekosaur> if it's inline, probably not; you get to refactor
18:22 <lyxia> nmdanny: I don't understand.
18:22 <geekosaur> of course it's always nice when you know up front where you need to factor stuff out >.>
18:22 <significance> How are types and kinds different? Aren't kinds just types of type constructors?
18:23 <geekosaur> that's a complex question given ghc8's type system :)
18:23 <shapr> geekosaur: I guess I'd change my per-line parser to return a list of values...
18:23 <shapr> hmm
18:23 <int-index> significance: turn on -XTypeInType and your view of this issue fits
18:23 <geekosaur> (types and kinds got unified)
18:23 <significance> int-index, geekosaur - awesome -- thanks!
18:23 <shapr> Right now the parser is E <$> callid <* space <*> float <* space <*> method
18:24 <geekosaur> ok, so I'd change callid and method, which now return lists, and then let the compiler show me where types need to be updated elsewhere
18:24 <geekosaur> with foresight I might have made the result types ADTs so that part could be refactored once each
18:24 <geekosaur> (and now the compiler tells me where the actual uses need to be fixed to handle lists)
18:25 <shapr> ah, I see. Then I can just zip the list together with the single relative_time
18:25 maarhart joined
18:25 <lpaste_> nmdanny pasted “what I'm trying to do with ArrowChoice” at http://lpaste.net/353900
18:25 <nmdanny> lyxia: this is what I'm trying to do ^
18:27 mbuf joined
18:27 peterbec` joined
18:27 cdg joined
18:31 KongWubba joined
18:31 DataComputist joined
18:32 jbiesnecker joined
18:32 lambdafan joined
18:32 <lpaste_> lambdafan pasted “map lens problem” at http://lpaste.net/353901
18:34 Dembel joined
18:34 <glguy> lambdafan: fmap snd
18:34 Igloo joined
18:34 insitu joined
18:34 wraithm joined
18:35 <lyxia> nmdanny: strange, but I'm not familiar enough with arrows to figure this one out :/
18:36 michaelw joined
18:36 <nmdanny> I think the problem is that, values computed within an arrow may only be passed to the right of '-<'
18:37 <nmdanny> so basically I'd need the following arrow: (ArrowChoice a) => a (XmlTree,VehicleMeta) XmlTree, then I could pass the value from the case expression into this arrow
18:38 mac10688 joined
18:39 <nmdanny> but then I have another issue: I can only pass 'VehicleMeta' to arrows that expect it.. and obviously HXT's arrows don't expect it
18:40 sssilver joined
18:41 iomonad joined
18:41 <lambdafan> glguy : the problem is an artifical one, the actual problem uses lenses, and '_2' is a stand-in for that.
18:41 wildlander joined
18:41 <glguy> ok, fmap (view _2)
18:42 BlueRavenGT joined
18:42 dfeuer joined
18:43 <lambdafan> glguy: thanks :)
18:43 <nmdanny> can the following function be defined:?
18:43 <nmdanny> Arrow a => a (input,extraData) output -> (extraData -> a input output)
18:44 mac10688_ joined
18:45 <glguy> nmdanny a extraData = proc input -> a -< (input, extraData)
18:46 <glguy> nmdanny :: Arrow t2 => t2 (t1, t) t3 -> t -> t2 t1 t3
18:46 Yuras joined
18:47 dc0de joined
18:48 wraithm joined
18:48 owiecc joined
18:49 JuanMiguel joined
18:50 <nmdanny> and can the inverse function be defined?
18:50 <nmdanny> Arrow a => extra -> a input output -> a (input,extra) output
18:51 <glguy> ignoreExtra _ a = proc (input, _) -> a -< input
18:52 iomonad joined
18:52 mac10688__ joined
18:52 MP2E joined
18:54 limlinlo joined
18:54 mac10688 joined
18:55 <nmdanny> sorry, I meant this function
18:55 <nmdanny> Arrow a => (extra -> a input output) -> a (input,extra) output
18:55 mattyw joined
18:55 <glguy> nope
18:55 maarhart joined
18:55 animated joined
18:55 fingerzam joined
18:57 deepfire joined
19:00 max-m joined
19:00 MrcRjs joined
19:01 mkoenig joined
19:01 carlosdagos joined
19:01 hendi joined
19:01 chaosmasttter joined
19:01 fizruk joined
19:02 e14 joined
19:02 jbiesnecker joined
19:02 sillyotter joined
19:06 cstrahan joined
19:08 <nmdanny> hurray I found out what I need, ArrowApply
19:09 <zcourts_> Using the GHC API, can a target be loaded from a String? i.e. I saw the Target constructor in the docs, constructed a target but when I try it, it fails with "module ‘Test.hs’ is a package module"
19:09 Itkovian joined
19:09 wraithm joined
19:10 deepfire joined
19:10 <geekosaur> I think that means "yes but..."
19:11 fProgrammer joined
19:11 <* geekosaur> has seen that "is a package module" but doesn't recall what it denotes, aside from it's looking for the wrong droid :)
19:11 <geekosaur> https://parenz.wordpress.com/2013/08/17/ghc-api-interpreted-compiled-and-package-modules/
19:13 <zcourts_> thanks, I'll give that a read and see if I can suss what's going on
19:13 <geekosaur> in short, it doesn't load anything, just sets an already loaded thing as the current target
19:13 <geekosaur> that page does say how to do the actual load
19:14 <zcourts_> ahh, name's a bit misleading but I get it
19:15 <geekosaur> it;s not misleading in its intended context (this is working at the level of a "make" program, not a compiler)
19:15 <fProgrammer> Quick question: I've my own data type "Node" with a generic implementation of ToJSON . I want to serialize a hashmap of type (Map Node (Set Node)) Whenever I try to do that I get a compile error: No instance for (aeson-1.0.2.1:Data.Aeson.Types.ToJSON.ToJSONKey Node) arising from a use of ‘json' Ideas?
19:16 anuxivm joined
19:16 <geekosaur> btu you do have to keep those levels straight when ghc conflates them (arguably this got worse when --make became the default mode)
19:16 Gurkenglas__ joined
19:16 augur joined
19:17 cereal_killer_ joined
19:17 <fProgrammer> anyone?
19:18 suppi joined
19:18 vlatkoB joined
19:19 djanatyn joined
19:19 <djanatyn> (++) <$> (Yell "good afternoon ") <*> (Yell "fellow haskellers")
19:19 <djanatyn> >>> "GOOD AFTERNOON FELLOW HASKELLERS"
19:19 chewzerita joined
19:20 Claudius1aximus joined
19:20 coot joined
19:20 howefield joined
19:21 epsilonhalbe joined
19:21 isidore joined
19:22 epsilonhalbe left
19:23 peterbec` joined
19:23 oish joined
19:23 peterbecich joined
19:23 <zcourts_> geekosaur: you're right in that it isn't in that ctx. Read the post/code from the link - that's very helpful, thanks.
19:23 halogenandtoast joined
19:26 cdg joined
19:27 marsam joined
19:30 revprez joined
19:30 zcourts joined
19:30 chewzerita joined
19:30 robertkennedy joined
19:31 stef204 joined
19:33 jbiesnecker joined
19:33 sssilver joined
19:35 nakal_ joined
19:37 int-e joined
19:37 insitu joined
19:39 int-e joined
19:39 schjetne joined
19:41 bennofs joined
19:42 int-e joined
19:42 int-e joined
19:42 chaosmasttter joined
19:43 jbiesnecker joined
19:48 e14 joined
19:48 Gurkenglas__ joined
19:48 takuan joined
19:49 marcopullo joined
19:49 BlueRavenGT joined
19:53 mkoenig joined
19:53 zyla joined
19:53 melop joined
19:54 insitu joined
19:54 vishalIRC left
19:55 MrcRjs joined
19:56 augur joined
19:56 govg joined
19:57 sea_wulf joined
19:59 jbiesnecker joined
20:00 kuribas joined
20:01 oisdk joined
20:01 <adelbertc> is it possible to derive Monoid ? my google-fu does not seem to be able to turn anything up
20:01 robotroll joined
20:01 <adelbertc> i currently have `data Foo = Foo { x :: Int, y :: Int }`
20:01 sovreign_ joined
20:01 dfeuer joined
20:01 Itkovian joined
20:01 ludat joined
20:01 <adelbertc> i could do newtype deriving if i re-formulate it to `newtype Foo = Foo (Int, Int)` but wondering if there is a way to do it with the formulation i have above
20:03 nilof joined
20:05 albertus1 joined
20:06 phyrex1an joined
20:06 augur joined
20:06 <geekosaur> there is the question of what it would mean for such a type
20:07 <adelbertc> i would assume the behavior to be equivalent to tuple-ifying it and using the newtype equivalent
20:07 <geekosaur> the naïve approach would apply it to the first element, then the second --- but you would never actually reach the second because of how Int works
20:07 <adelbertc> ah ok
20:07 <adelbertc> i am convinced now
20:07 <geekosaur> newtype deriving just exposes the underlying thing, it doesn't get you a meaningful tuple instance
20:08 <geekosaur> and I don't know offhand if there's a tuple instance
20:08 <adelbertc> there is
20:08 <adelbertc> (Monoid a, Monoid b) => Monoid (a, b)
20:08 <bengt_> pls
20:08 <bengt_> mt
20:09 uglyfigurine joined
20:09 jbiesnecker joined
20:10 MrcRjs joined
20:10 uglyfigurine joined
20:11 howefield left
20:11 {emptyset} joined
20:11 SpinTensor joined
20:12 oisdk_ joined
20:13 ramzifu joined
20:13 <ertes> adelbertc: you can use the generic-deriving library to derive product monoids
20:13 ner0x652 joined
20:14 <ertes> adelbertc: but it requires that all factors are monoids by themselves
20:14 <adelbertc> ertes: is that a common thing to do in Haskell, or do people generally just write it by hand
20:14 <ertes> so you need something like Sum Int rather than just Int
20:14 <cocreature> is there any Monad for which traverse_ is more efficient than mapM_?
20:14 <ertes> adelbertc: i use generic-deriving for that purpose a lot… can't speak for other people though
20:14 schell_ joined
20:14 <cocreature> I feel slightly bad for using mapM_ but I’m also too lazy to type traverse_
20:14 <bennofs> cocreature: Writer (First a) perhaps?
20:15 <monochrom> I write by hand a lot.
20:16 <cocreature> bennofs: how so? or do I need to work through the instances myself :)
20:16 dylukes joined
20:16 <bennofs> cocreature: idk, i thought that perhaps the Writer can take advantage of the fact that First can short-circuit
20:17 <ertes> cocreature: traverse_ should really be in Prelude =)
20:17 <bennofs> (the Applicative one)
20:17 <ertes> along with for_
20:17 <cocreature> ertes: it would still be longer than mapM_ :)
20:17 <cocreature> bennofs: hm, interesting. I’ll take a look
20:18 <adelbertc> how sketchy is FlexibleInstances
20:18 <adelbertc> seems pretty sketchy in that it breaks type class coherence
20:18 <adelbertc> or has the potential to
20:20 <geekosaur> you still get warnings (errors if you don't specify overlap/incoherence) if you do that
20:21 <adelbertc> seems sketch
20:21 <cocreature> how so?
20:21 <fresheyeball> athan: why did you leave nixos for your workstation?
20:21 connrs joined
20:22 <geekosaur> also the Haskell2010 spec is much tighter than it needs to be for coherence, which is why the FlexibleInstances extension exists
20:22 <geekosaur> but this does not disable checking for incoherence, it just lets you build stuff in what would otherwise be in the gray area between what the standard permits and what is actually incoherent
20:23 <geekosaur> you would still need the IncoherentInstances extension to be actually incoherent, or use the OVERLAP / OVERLAPPABLE pragmas to specify when overlapping instances are permitted
20:24 <adelbertc> ah
20:24 <adelbertc> that makes me feel a bit better
20:25 ramzifu joined
20:25 bollu joined
20:25 trxeste_ joined
20:26 <trxeste_> hello
20:26 <cocreature> hey trxeste_
20:26 MrcRjs joined
20:26 <trxeste_> can somebody help me?
20:26 Itkovian joined
20:26 <cocreature> trxeste_: if you tell us what your problem is we might be able to :)
20:26 <geekosaur> depends; what's the question?
20:27 <trxeste_> i cant install cabal-install-1.24.0.2 under gentoo calculate-linux
20:27 <trxeste_> here is my log
20:27 conal joined
20:27 <trxeste_> http://pastebin.com/ZRxMQB9K
20:27 <cocreature> trxeste_: that log does not even mention cabal
20:28 gillesmajor joined
20:28 <trxeste_> it's a dependency of cabal-install
20:29 <trxeste_> i could'nt solve it
20:29 shanemikel joined
20:29 <cocreature> maybe I don’t know enough about gentoo but I don’t see any error in your log
20:29 gillesmajor left
20:29 <cocreature> what is failing?
20:29 conal joined
20:29 Itkovian joined
20:30 cfricke joined
20:31 sssilver joined
20:31 tommd joined
20:32 <geekosaur> that's not actually a log, just a summary of the build environment. I'd suspect you need to talk to the maintainer of the gentoo port though
20:32 jbiesnecker joined
20:32 nomotif joined
20:33 cdg joined
20:34 eschnett joined
20:34 hucksy_ joined
20:34 <trxeste_> simply can't solve this dependency
20:35 wtetzner joined
20:35 Itkovian joined
20:37 mmachenry joined
20:40 tushigushi joined
20:41 MrcRjs joined
20:41 conal_ joined
20:41 hybrid joined
20:44 wraithm joined
20:45 osa1 joined
20:45 osa1 joined
20:47 vydd joined
20:47 vydd joined
20:47 takle joined
20:48 vydd joined
20:48 vydd joined
20:48 cdg joined
20:49 incomprehensibly joined
20:49 erisco joined
20:49 shanemikel joined
20:50 danvet_ joined
20:51 georgew joined
20:51 Vzox01 joined
20:54 skapazzo joined
20:55 PennyNeko joined
20:56 MrcRjs joined
20:57 tjpeden joined
20:57 eschnett joined
20:58 MrcRjs joined
21:00 jbiesnecker joined
21:00 mmn80 joined
21:01 carlosdagos joined
21:02 zzz joined
21:02 deepfire joined
21:04 ramzifu joined
21:09 <erisco> hm
21:10 <erisco> I want to accumulate over each factor of [[a]] but short-circuit
21:10 <erisco> so, for example, [[1,2],[3,4]] the factors are [[1,3],[1,4],[2,3],[2,4]]
21:10 <monochrom> What is a factor?
21:11 coot joined
21:11 <erisco> the n-ary Cartesian product
21:11 <c_wraith> err. sequence?
21:11 xcmw joined
21:11 <benzrf> what do you mean about short circuiting
21:11 <monochrom> Under what condition should short-ciruit happen?
21:11 <c_wraith> or do you want to skip pieces but resume later?
21:12 <monochrom> > sequence [[1,2], [3,4]]
21:12 <lambdabot> [[1,3],[1,4],[2,3],[2,4]]
21:12 <erisco> right, so for example I will see the number 1 and I may decide I do not want to see any factors that include 1
21:12 <Sornaensis> :t sequence
21:12 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
21:12 <erisco> so I short circuit and do not further look through [1,3] and [1,4]
21:13 timrs2998 joined
21:13 <erisco> in an n-ary product this can save a lot of redundant work
21:13 Gurkenglas joined
21:13 <c_wraith> erisco, have you looked at a bunch of posts from a couple years back about the SEND MORE MONEY problem?
21:13 <erisco> I am aware of sequence, thanks :)
21:14 <erisco> c_wraith, no
21:14 <Cale> erisco: In that case, you don't *quite* want sequence, but you want something whose implementation looks a lot like it, except that it implements your condition as a guard.
21:14 <monochrom> Is it OK to pre-filter? I mean this: sequence (map (filter (/= 1)) [[1,2], [3,4]])
21:14 <erisco> I know I don't want sequence, that is why I am not using it ^.^
21:14 <c_wraith> erisco, https://www.schoolofhaskell.com/user/chowells79/even-more-money
21:14 <monochrom> > sequence (map (filter (/= 1)) [[1,2], [3,4]])
21:14 <lambdabot> [[2,3],[2,4]]
21:14 <c_wraith> erisco, it links to a bunch of other posts on the topic.
21:14 merijn joined
21:14 <Cale> > do x <- [1,2]; guard (even x); y <- [3,4]; return (x,y)
21:14 <lambdabot> [(2,3),(2,4)]
21:14 <ertes> > [ (x, y) | x <- [1..5], even x, y <- [3,4] ]
21:15 <lambdabot> [(2,3),(2,4),(4,3),(4,4)]
21:15 <erisco> monochrom, no, because I need an arbitrary prefix of the factor to determine if I want to keep going with it
21:15 <ertes> erisco: the list monad short-circuits
21:15 <ertes> by itself
21:15 <monochrom> Ah, then what they said.
21:15 mmachenry joined
21:15 <ertes> erisco: you just need to make sure that you place your guard as early as possible, i.e. the following would not short-circuit:
21:16 <ertes> > [ (x, y) | x <- [1..5], y <- [3,4], even x ]
21:16 <lambdabot> [(2,3),(2,4),(4,3),(4,4)]
21:16 <Cale> Ah, but perhaps he wants cut
21:16 <ertes> same result, but needs to scan every possible pair
21:16 wraithm joined
21:16 <Cale> i.e. he wants to go through some of the y's and arbitrarily decide at some point to skip the remainder of them
21:17 <ertes> ah
21:17 <erisco> I am accumulating over each factor, and at some point I may decide no factors with this prefix are interesting
21:17 <erisco> so short-circuit by not iterating through any more factors of that prefix
21:18 <ertes> > [ (x, y) | x <- [1..5], even x, y <- takeWhile even [2,4,6,7,8,9], mod (x + y) 3 /= 2 ]
21:18 <lambdabot> [(2,2),(2,4),(4,2),(4,6)]
21:18 <ertes> something like that?
21:18 <Cale> There is probably a rather nice solution involving ContT
21:18 <erisco> I'll have to read over these suggestions carefully
21:18 petervaro joined
21:18 <Cale> Well, perhaps you can get by with takeWhile, try that first :)
21:19 <ertes> of course takeWhile's predicate can refer to 'x' as well =)
21:19 tommd joined
21:19 <erisco> thanks for the suggestions, I'll get back to you
21:21 <merijn> Right, so we're now up to at least 7 reimplementations of my Monoid suggestion for Map. I wonder whoever came up with the current Monoid, as it's clearly not as popular as the sensible one
21:21 cyborg-one joined
21:21 <merijn> I wish Haskell had a better story for fixing historical mistakes wrt typeclass implementations >.>
21:22 <ertes> merijn: instance (Monoid a, Ord k) => Monoid (Map k a) -- i would kill for that instance
21:22 <merijn> ertes: Right, I know
21:22 <merijn> ertes: Everyone seems to be reimplementing it, but it's not in containers
21:22 <ertes> yes
21:22 <merijn> I don't think I've ever actually seen the current Monoid in use
21:22 <merijn> ertes: Well, hop on to libraries@ and help me beat some sense in to people :p
21:23 <ertes> merijn: does anyone actually disagree?
21:23 <merijn> Or I should somehow talk dfeuer into sneaking it in behind people's backs
21:23 wraithm joined
21:23 <ertes> merijn: containers 0.6 is long overdue anyway =)
21:23 BartAdv joined
21:23 <merijn> ertes: Well, some people don't want to add a newtype for it (I've preemptively given up changing the current instance(
21:24 greylica joined
21:24 <merijn> Because that backwards compatibility thing is never happening given people's complaints about not breaking things that might never be used
21:24 <merijn> I wonder if there's a way to survey hackage and find all uses of the Map monoid...
21:24 <ertes> that's what we have the PVP for
21:24 <ertes> fix it, make it 0.6
21:24 <merijn> ertes: You try and convincing people of that
21:25 yogsotot_ joined
21:25 ondrejs joined
21:25 <ertes> personally i think just providing a pull request might be a better strategy than arguing on libraries@ =)
21:25 <merijn> I've tried that sorta thing a few times, some people are stubbornly against fixing anything that might, conceivably break code
21:26 <merijn> ertes: In hindsight, maybe
21:26 <ertes> in fact i'm not even subscribed there
21:26 <monochrom> Devil's advocate: The reason PVP does not solve this is that by version 0.7 you have both this semantic change and unrelated performance improvements. People who want just the unrelated performance improvements have nothing to fall back on.
21:27 <merijn> monochrom: We change the monoid instance and add a newtype for the current nonsense instance, problem solved!
21:27 <monochrom> This shows that PVP, by nature of being sequential, does not address the real contention at all. You need a branching versioning scheme, even a DAG.
21:27 <ertes> monochrom: the thesis is that nobody actually uses the current Monoid instance
21:27 <bollu> what's PVP?
21:27 <merijn> I've never seen it used, at least
21:27 <merijn> But I don't know how to survey hackage to be sure
21:27 <merijn> If someone is bored/has more time to waste then me, I would love numbers to back me up :p
21:27 logzet joined
21:27 <monochrom> Yes, I agree, this is why I put up that point as "devil's advocate". But do understand that the same kind of issues will genuinely arise for other libraries.
21:28 <bollu> there is a monoid instance for Map?
21:28 <merijn> bollu: Yes, left-biased union
21:28 <bollu> what is it, replace things that already exist and put stuff that doesn't?
21:28 <cocreature> bollu: https://pvp.haskell.org/
21:28 <bollu> wait, left biased?
21:28 <bollu> wtf
21:28 <ertes> monochrom: more seriously, if we do something like AMP and FTP, we can fix the Monoid instance of Map, too =)
21:28 <bollu> why not right?
21:28 <bollu> oh wait
21:28 <bollu> left may make sense
21:28 <bollu> hm, I'm not sure
21:28 <ertes> *if we can do
21:28 <bollu> a <> b <> c == a?
21:28 <merijn> yes
21:29 <monochrom> Haha yes, we already opened Pandora's box, may as well ramming speed.
21:29 <merijn> you could use dual to make it right biased :p
21:29 <ertes> merijn: i'm in favour of breaking changes, and i'll happily accept the maintenance cost of having to fix my code
21:29 <Cale> ertes: This change is worse though
21:30 coot joined
21:30 <merijn> let's never make changes that make writing future code easier if it risks breaking already bitrotted code!
21:30 <Cale> In the regard that code written with the old Monoid instance will often still work after the change, but it will do different stuff
21:30 <Cale> So absolutely everything will need to be audited.
21:30 <ertes> true
21:31 <monochrom> You know what, s/Pandora's box/Paradise/
21:31 KongWubba joined
21:31 <monochrom> Heaven has come, why not fully embrace it!
21:31 <merijn> I wonder if I can get a student to audit hackage for uses of the Map monoids and patch all of them...
21:32 <merijn> maybe then people would accept it...
21:32 <ertes> well, here is a way to do it: add a DEPRECATED warning to the current Monoid instance and wait a year
21:32 praduca joined
21:32 <monochrom> (Looking at some of my old code, I think AMP is Heaven. I don't have a strong feeling about FTP yet.)
21:32 JoshS joined
21:32 <ertes> monochrom: both are heaven for me
21:32 <ertes> > null Nothing
21:32 <lambdabot> True
21:33 <merijn> I like FTP, but I don't like everything that was generalised into FTP
21:34 <merijn> i.e., I think length was a mistakes
21:34 <merijn> Although I've used it a few times
21:34 <monochrom> I know right? FTP is hardwired with Monoid, and you will dislike it iff you run into a Monoid instance you dislike... :)
21:34 <ertes> well, it's fine to generalise it, as long as you're aware that it might not be the best implementation for your particular type
21:35 ajaXHorseman joined
21:37 praduca|2 joined
21:38 Itkovian joined
21:39 praduca joined
21:39 sssilver joined
21:40 <merijn> Actually, maybe I should make that my main goal of going into education...suckering students into fixing the stuff I can't be arsed too in the Haskell ecosystem, pretend it's educational and shit or something :p
21:40 <JavaSucksMan_> FTP?
21:41 <monochrom> the Foldable-Traversable Proposal.
21:41 <geekosaur> "foldable/traversable proposal" or why Data.List module now reexports Data.Foldable instead of being about lists
21:41 <monochrom> We need to drop the P because it is no longer a proposal, it is a reality.
21:41 <geekosaur> ^
21:41 <mauke> foldable-traversable problem
21:42 <monochrom> Foldable-Traversal Prosperity :)
21:42 <Theophane> \o/
21:42 <monochrom> But anyway the same thing happens to RFC.
21:43 Itkovian joined
21:43 raichoo joined
21:43 <ertes> instance (Monoid a, Ord k) => Monoid (Map k a) where mappend xs ys = trace "mappend: BTW, I'm no longer the bullshit instance I used to be, so you may need to acknowledge my brilliance by fixing your code" (M.unionWith (<>) xs ys); …
21:43 <monochrom> And in Star Trek, NCC.
21:43 <* Jello_Raptor> facepalms
21:44 <Jello_Raptor> turns out replacing my O(N^3) placeholder algorithm with an O(n) algorithm means I use an order of magnitude less time and space. I just forgot about the placeholder after I had checked the other stuff for correctness.
21:45 <Jello_Raptor> is there an idiom for this? like using WARNING or DEPRACATED pragmas as reminders of these things?
21:45 e14 joined
21:46 <srhb> Jello_Raptor: badGorithm = ...
21:46 <geekosaur> heh
21:47 <* geekosaur> is reminded of using a placeholder bubblesort in a tool he'd developed, intending to replace it later, and having it (a) be productized (b) still with the placeholder
21:47 <ertes> "badGorithm" sounds like: "bad practice borrowed from go"
21:47 <mauke> foo x = trace "FIXME" $ badImpl x
21:48 <geekosaur> (having run into what was later shown to be a bug in standard unix qsort())
21:49 <Jello_Raptor> yeah, this was basically the same thing, instead of keeping a reverse lookup table, I was just looking at every value in the table for things that fit a pattern and modifying them
21:49 vydd joined
21:50 <Jello_Raptor> mauke: this function is called an immense amount of times in each run. Adding a trace there would mean the syscalls to print dominate the runtime. (I had a trace in there for other reasons at one point)
21:50 jbiesnecker joined
21:50 <ertes> protoduction at its best
21:50 <Jello_Raptor> ertes: best part is that it's still *correct* just slow as balls
21:50 <mauke> Jello_Raptor: is that a problem?
21:51 meoblast001 joined
21:51 <Jello_Raptor> mauke: when the memory use of the program make a server with 120gb of RAM thrash, yes. yes it is.
21:52 <ertes> "AWS, what can i do for you?" – "i'd like to book more cloud resources, specifically CPU and RAM" – "sure, how much?" – "the rest"
21:52 <Jello_Raptor> hah
21:52 coot joined
21:52 <jle`> Jello_Raptor, mauke: ghc already gives you a way to emit a compiler warning when you compile code using a certain function
21:52 <jle`> *code that uses a certain function / value
21:52 <jle`> best of both worlds i suppose
21:52 <monochrom> ertes: Somehow that sounds like what Dogbert might do. :)
21:53 <ertes> monochrom: sorry for ruining the joke, but who's that? =)
21:53 hiratara joined
21:53 whaletechno joined
21:53 <merijn> ertes: Dilbert character
21:53 <monochrom> Dilbert's pet. But the pet dominates, and is evil.
21:53 <Jello_Raptor> jle`: mm? I was just asking if there's a standard otherwise I was just going to make a habit of using WARNING pragmas as particularly important TODOs that are hard to forget
21:54 <ertes> dilbert doesn't ring a bell either
21:54 <monochrom> or maybe just s/evil/likes to pull pranks on humanity/
21:54 <monochrom> OK, dilbert.com :)
21:54 <geekosaur> it's a comic inspired by the author's time at pacific bell
21:54 <ertes> ah =)
21:54 ChaiTRex joined
21:54 <geekosaur> pretty much every management dysfunction you can imagine
21:54 <geekosaur> and a few more on top
21:54 <Jello_Raptor> ertes: old "engineers in an office" comic, a classic, but I'd not rate it worth people's free time anymore v0v
21:55 permagreen joined
21:55 <jle`> Jello_Raptor: oh i didn't notice your original question
21:56 <merijn> There are more original/funny comics, yes :p
21:56 <Jello_Raptor> jle`: no worries :) nobody answered it after all :P
21:56 <jle`> WARNING/DEPRECATED seems like a good way to go
21:56 <jle`> but
21:56 <geekosaur> the early dilbert was original and funny. it degenerated later, plus all the clones...
21:56 <jle`> it doesn't emit the warning if you use it within the defining module
21:56 <geekosaur> (plus that we all know about it now)
21:57 <Jello_Raptor> jle`: ooh :/ that invalidates a lot of how i tend to organize things.
21:57 <geekosaur> Jello_Raptor, to be honest, for this you probably want the gnu linker annotation stuff
21:57 <Jello_Raptor> geekosaur: mmm?
21:57 <jle`> Jello_Raptor: maybe you can use CPP and have the function only be available if you pass a --dev flag
21:57 <geekosaur> (although that may not help on non-linux)
21:57 <jle`> and if there's no --def cpp flag then the function isn't defined and it doesn't compile
21:57 <jle`> (or just emits an error)
21:57 <geekosaur> you can annotate a function so that, if the linker finds it being referenced, it spits out a warning
21:57 <jle`> this is not standard so don't listen to me
21:58 <geekosaur> if you try to compile on linux a program that calls the old gets() stdio API, you'll see it in action warning you about buffer overflows and such inherent in it
21:58 <monochrom> If the function is inlined, you will not get a linker warning :)
21:58 <ertes> Jello_Raptor: yeah, i looked at a few… they weren't funny =)
21:59 <geekosaur> well, for this you'd need (a) a C stub to which you can attach said annotation (b) an analog of trace (which is to say, unsafePerformIO) to attach it to the Haskell code
21:59 <ertes> i have no idea how xkcd manages to still be funny after so many years
22:00 <geekosaur> a big part of the problem with dilbert is scott adams just started using stuff readers sent him, without a lot of critical thought
22:00 <merijn> ertes: I think XKCD is much less funny these days then, say, SMBC which is both funnier and more consistently so
22:00 fotonzade joined
22:01 <jle`> every once in a while i forget it exists and then check up again and see that it's still consistent quality. (re: xkcd). i'm sure its readership has gone down in the past few years, and the author has had various other large projects besides xkcd since them too, but it doesn't stop randall from his commitment to quality
22:01 <jle`> also i hear that randall hangs out here from time to time so hi
22:01 <* jle`> waves
22:01 <ertes> you know, we could come up with lambdacats that are actually funny
22:01 <geekosaur> that'd be nice
22:02 <jle`> smbc has only gotten better over the years yes
22:02 <ertes> the cartesian closed comic is quite good, too, but there aren't too many issues
22:02 <hpc> jle`: i know the site admin says things here sometimes
22:02 <ertes> one of my favourites: https://ro-che.info/ccc/23
22:02 <ertes> =)
22:03 <hpc> (the xkcd admin)
22:03 <jle`> yeah, being able to nail some inspired jokes is different from having the ability to consistently churn them out
22:03 <jle`> i think it's a completely different skillset/talent altogether
22:03 doodlehaus joined
22:03 <jle`> hpc: yes i've heard that he has asked questions about implementing some haskell code for an xkcd comic, heh
22:04 <ertes> also i'm kinda fascinated that this one actually did become irrelevant: https://ro-che.info/ccc/21
22:05 <c_wraith> the backend for the comic where there were thousands of punchlines depending on a bunch of factors was done in Haskell.
22:05 <Ferdirand> https://xkcd.com/1312/ :(
22:06 <ertes> Ferdirand: yeah, there are so many ways to make fun of haskell, but that's not one of them
22:06 Ranhir joined
22:07 jbiesnecker joined
22:08 uglyfigu_ joined
22:08 e14 joined
22:08 abel-abel joined
22:09 <abel-abel> hello. Is there anyway in Emacs to goto definition for functions in standard library?
22:09 coot joined
22:10 eazar001 joined
22:10 <ertes> abel-abel: as far as i'm aware haskell-mode can't cross package boundaries, although i believe there is a way to integrate hoogle
22:11 mkoenig joined
22:12 <abel-abel> ertes: thank you. I am looking for a plugin to do this.
22:13 mmachenry joined
22:15 <praduca> Hi, i'm getting some trouble with haskell on nixos
22:16 conal joined
22:17 <praduca> someone have some tutorial or other resource on using correctly the haskellng on nixos? after doing what it says on A Journey into the Haskell NG infrastructure, i started to get some errors...
22:18 noan joined
22:18 troydm joined
22:19 <ertes> praduca: what errors do you get?
22:19 ramzifu joined
22:20 <praduca> not in haskell, on installing packages on nixos, so i can't have for sure that what i did is correct
22:20 <praduca> it should interfere on system? i started to get messages of name collision error when installing things
22:22 <praduca> I asked this on nixos but nobody answered (yet)
22:22 Itkovian joined
22:26 gugah joined
22:26 <ertes> praduca: is this about installing haskell packages into your user environment?
22:26 <ertes> or about using nix to build your haskell projects
22:26 gugah joined
22:28 <praduca> Hm, I think it is, because that haskellng "stuff" is about that, but i get problems only using stack with nix usage enabled
22:29 taksuyu joined
22:30 doodlehaus joined
22:30 <praduca> and this "side effect" of clash of names too, that i really can't understand. I think this is more on NIXOS than haskell itself, but i cant find documentation for neither (about that)
22:31 hiratara joined
22:31 <Cale> praduca: In my experience, nix people usually use nix to build their Haskell packages. It ought to be possible to use stack, but it seems a bit odd, when your entire environment is set up to do what stack does, only better.
22:32 <Cale> (I don't use nixos myself, but we do use the nix package manager where I work to build things)
22:32 dylex joined
22:32 bjz joined
22:32 <praduca> hm, thats interesting. The thing is i'm getting a course on yesod, and this thing is heavily dependent (the documentation) on the stack commands
22:32 <Cale> ah
22:33 <ertes> praduca: yeah, if you have nix, there is little reason to use stack
22:33 coltfred joined
22:33 <ertes> praduca: however the way to install packages into your environment is a bit different from the way you build your packages for development
22:34 <ertes> praduca: that's why it would be useful to know what it is you're trying to do
22:34 simukis__ joined
22:34 sea_wulf joined
22:35 moonarch[m] joined
22:35 <praduca> At the moment I'm just trying to setup the environment for the part of the course that use stack (will start one month from now)
22:35 <praduca> i was on ubuntu until some weeks, then discovered nixos
22:36 <praduca> everithing on it is marvelous, until you need to understand something more profoundly :)
22:36 <sea_wulf> praduca: do you like nixos? How would you compare it to something like arch?
22:36 <moonarch[m]> +1 for nixos
22:37 <ertes> praduca: the best way to use stack on NixOS is to ignore the fact that you're on NixOS =)
22:37 <ertes> at least i think… i don't really have stack experience
22:37 <praduca> it's crazy good, it's what you expect if someone ask you to make a linux "on rails"
22:38 umib0zu joined
22:38 <ertes> sea_wulf: i think #nixos is a better place for that particular question =)
22:39 <sea_wulf> ertes: true facts. I was just wondering how it fared in terms of hs development
22:39 JeanCarloMachado joined
22:40 <MP2E> generally speaking, haskell development on nixos involves using 'cabal2nix --shell ~/projectdir > shell.nix', then run nix-shell on the generated expression.
22:41 <praduca> just to be clear, when you Cale: say that you use nix to build things, and the stack similarity, you mean nix-shell?
22:41 <MP2E> also note that haskellng is now just haskell, the old infrastructure was deprecated and removed long ago
22:41 <MP2E> the docs relevant to haskellng should work if you just rename the parts that say haskellng to haskell, though.
22:41 dpren joined
22:42 <ertes> praduca: nix-shell for the development part, nix-build/nix-env for testing/deployment
22:42 <ertes> at least that's my workflow… you can be a bit creative in how you do it
22:42 <praduca> OH GOD THANKS MP2E: this is the kind of info i was trying to get.
22:42 coot joined
22:42 <Cale> (and nix-copy-closure for deployment :D)
22:43 shanemikel joined
22:43 <MP2E> no problem :)
22:43 <praduca> thanks to all, will try all that and maybe put in some blog :)
22:43 <MP2E> nixos is a great os but we really suffer from lack of documentation
22:43 <MP2E> that would be appreciated !
22:44 <ertes> praduca: if you like to use haskellPackages, i can show you my setup, if you prefer to make your own package set, you can see how reflex-platform works
22:44 <praduca> ertes: i will like that
22:44 Jesin joined
22:44 <ertes> the former is just plain hackage, while the latter is more like somthing like stackage LTS
22:45 <ertes> plain hackage has worked for me so far
22:45 arpl left
22:45 conal joined
22:46 ph88_ joined
22:47 ompaul joined
22:47 Voldenet joined
22:47 Voldenet joined
22:47 <praduca> ertes: but you need to declare something to access those (.nixpkgs folder i mean), or this is default
22:47 tommd joined
22:47 NeverDie joined
22:47 <ertes> praduca: i'm using a few overrides: <https://github.com/esoeylemez/config/blob/master/files/.nixpkgs/config.nix>
22:48 pixelfog joined
22:48 <ertes> praduca: to launch a GHCi on a haskell project i've written this: <https://github.com/esoeylemez/config/blob/master/bin/nix-ghci>
22:48 <ertes> it's a bit hacky, but it works
22:48 <MP2E> neat, I like asGit. looks convenient :)
22:49 <MP2E> i have a similar setup https://github.com/MP2E/nix-projects/blob/master/nixpkgs-config/config.nix#L44
22:49 <ertes> reason being that haskell-interactive-mode doesn't have support for nix, so i'm using its GHCi process-type, but use my nix-ghci wrapper script
22:49 OscarZ joined
22:50 <praduca> tks people, will study all this and see what fits best. Really appreciated the help!
22:50 <ertes> MP2E: i'm not overly fond of asGit myself… the real solution is to get default.nix out of the project directory =)
22:50 <ertes> it was a quick-n-dirty way to have both with a single default.nix
22:50 <MP2E> ah :p
22:51 <* dmj`> wishes ghc-musl was on nixpkgs
22:56 <ertes> MP2E: (asGit is fine… it's just the way i use it that isn't) =)
22:56 <ertes> so feel free to copy it =)
22:57 lambdabot joined
22:58 <MP2E> thanks :)
23:02 carlosdagos joined
23:03 scope joined
23:03 <scope> monochrom you here?
23:06 exferenceBot joined
23:06 vektorweg11 joined
23:06 <scope> Maybe someone else can help me. I swear these functions were working yesterday, but now I just get "Exception: prelude.read: no parse"
23:06 <scope> here's the code http://lpaste.net/6430151029542617088
23:07 <scope> I'm passing a string that looks like "5.0 3.0 4.0 7.0"
23:07 Micamo joined
23:07 <jle`> scope: that isn't really oging to parse as a (Float, Float)
23:08 BlueRavenGT joined
23:08 <scope> jle` I'm pretty sure it was working fine yesterday
23:08 louispan_ joined
23:08 safe joined
23:08 <jle`> i'm skeptical :o
23:09 <jle`> might work with "(5,3) (4,7)"
23:09 <scope> let me try again
23:10 <jle`> but it's very fragile
23:10 cjhoward joined
23:10 <cjhoward> hey all
23:10 <scope> jle` that was the issue
23:10 <scope> lol
23:10 <scope> whoops
23:11 halogenandtoast joined
23:11 <lpaste_> lambdafan pasted “Tricky Traversal” at http://lpaste.net/353910
23:11 pera joined
23:11 <* lambdafan> yawps
23:12 wtetzner joined
23:12 <Nolrai> Is there a beter way to write "g <$> f x <*> pure y"?
23:12 <glguy> (`g` y) <$> f x; or flip g y <$> f x
23:13 <jle`> cjhoward: hi cjhoward
23:13 louispan joined
23:13 <glguy> f x <&> \z -> g z y
23:14 <Nolrai> I like the second (partly because my g is almost commutative).
23:14 <lambdafan> glyguy: I came across some lens examples you wrote on github.
23:14 <scope> jle`, at the moment I've hardcoded values, but say I wanted the toPoints function under main to read the points from a file passed through the command line
23:14 <scope> http://lpaste.net/6430151029542617088
23:14 <scope> how would I go about doing so?
23:15 <scope> I tried passing it stdin
23:15 <jle`> you can get a string from command line arguments using getArgs
23:15 <jle`> and you can read a string from a file using readFile
23:15 <lambdafan> scope, have you read LYAH?
23:15 <glguy> lambdafan: It'd be something like: itoListOf (game_data_gs . players_gd . p_map . ifolded <. score)
23:15 <scope> lambdafan for the most part
23:15 <lambdafan> glyguy: oh cool, I will play around with that
23:15 <cjhoward> does anyone have experience with Servant or Snap or any other web framework?
23:16 <lambdafan> cjhoward, I do with scotty and yesod
23:16 <cjhoward> lambdafan how are they? Have things been smooth?
23:16 m0rphism2 joined
23:16 <lambdafan> cjhoward, sure have. I started with Yesod not knowing much about either web dev or haskell.
23:17 <lambdafan> cjhoward: yesod is big, but that also means it does alot for you. I would recommend using Yesod, and then Scotty for when you have your head wrapped around the more challenging aspects of Haskell.
23:17 <cjhoward> lambdafan awesome! I'm pretty familiar with web dev, and still relatively new with Haskell. I'm thinking of doing my next project with a Haskell server side
23:18 <cjhoward> lambdafan what would you say is more challenging about Scotty?
23:18 <cjhoward> I will look at yesod
23:18 <lambdafan> well with scotty you will have to figure out the details of how you want to integrate the database, for example.
23:19 tromp joined
23:20 <cjhoward> Yes, I still haven't done any DB stuff with Haskell yet so I assume there will be some challenge there
23:20 <cjhoward> it feels like there is always so much to learn
23:20 marcopullo joined
23:21 <lambdafan> cjhoward, if you feel like there isn't any more to learn, it means you have stopped growing. There's always more.
23:21 <scope> ah jle` getContents was what I was looking for
23:21 <lambdafan> Yesod makes DB interfacing easy, if a bit crippled.
23:22 snowalpaca joined
23:22 <cjhoward> lambdafan, what do you mean by crippled
23:22 <cjhoward> lacking some features?
23:22 <lambdafan> well, it wants you to use (like I said, opinionated) a library called persistent, which has limitations that have been overcome by newer libraries.
23:22 <lambdafan> yeah persistent lacks some features.
23:23 <lambdafan> I think the up and comer is called OpalEye?
23:23 <cjhoward> hmm alright
23:23 <lambdafan> https://hackage.haskell.org/package/opaleye
23:23 <lambdafan> yeah that's the one
23:24 <Sornaensis> is opaleye as generic as persist
23:24 <athan> fresheyeball: Because I didn't have an ethernet connection :)
23:24 jao joined
23:24 <lambdafan> opaleye is better, but I am not sure how welel it is integrated with Yesod. It is of course possible to use with Yesod. it's a question of how much work would be required.
23:24 <athan> fresheyeball: Gentoo's dilema
23:25 <lambdafan> Sornaensis : good question.
23:25 <jle`> is there any nice library that lets me derive Num instances from simple product types using generics
23:25 <jle`> 5c
23:25 <cjhoward> lambdafan well i have some work to do haha
23:26 <lambdafan> Yesod has a nice tutorial, The primary author spends much effort on documenting. From an engineer's point of view, as opposed to an academic's.
23:26 <lambdafan> so, more examples, fewer proofs.
23:27 <cjhoward> yeah I like examples
23:27 <lambdafan> As do I.
23:27 <cjhoward> no need for proofs, many a times
23:27 mda1 joined
23:27 <lambdafan> well, I'd want proofs when it comes to testing time. But not as documentation.
23:28 <cjhoward> sure, sure
23:29 <lambdafan> glguy: thanks that was exactly right.
23:29 hybrid joined
23:30 michi7x7 joined
23:30 tommd joined
23:30 lambda-11235 joined
23:30 <cjhoward> lambdafan I'm going to take off for now. Thanks for the help
23:31 jascot[m] joined
23:31 justanotheruser joined
23:36 sdothum joined
23:36 anuxivm left
23:38 scope joined
23:39 cpup joined
23:40 michi7x7_ joined
23:44 systadmin joined
23:45 <scope> if I have a list of tuples of type float, is there a simple way to find the max value of the list of tuples? for instance if I have (5,3) (2,7) (5,15) I want to get the value 15
23:45 mson joined
23:46 <geekosaur> > maximumBy (comparing snd) [(5,3),(2,7),(5,15)]
23:46 <lambdabot> (5,15)
23:46 <scope> thank you geekosaur
23:47 <ChaiTRex> > maximum . curry max $ [(5,3),(2,7),(5,15)]
23:47 <lambdabot> error:
23:47 <lambdabot> • No instance for (Typeable t0)
23:47 <lambdabot> arising from a use of ‘show_M57767628145977763733546’
23:47 diegoksp joined
23:47 <ChaiTRex> > maximum . uncurry max $ [(5,3),(2,7),(5,15)]
23:47 <lambdabot> error:
23:47 <lambdabot> • Couldn't match expected type ‘(t0 c, t0 c)’
23:47 <lambdabot> with actual type ‘[(Integer, Integer)]’
23:48 <ChaiTRex> > maximum . map (uncurry max) $ [(5,3),(2,7),(5,15)]
23:48 <lambdabot> 15
23:48 <ChaiTRex> There
23:48 Rotaerk joined
23:48 <geekosaur> > maximum . map snd $ [(5,3),(2,7),(5,15)]
23:48 <lambdabot> 15
23:49 <jle`> scope: note that those will only get the max value of the second item of the tuples
23:50 <jle`> well, some of those
23:50 <ChaiTRex> Mine gets the max of all of the items in the tuples.
23:50 <scope> jle` that's honestly what I'm trying to do, here's an example
23:50 <scope> formatting is wrong, but toPoints is a list of tuples
23:50 <scope> http://lpaste.net/4514503561492561920
23:51 <scope> I'm trying to get the minimum x value, max x value, min y value and max y value
23:51 vydd joined
23:52 <scope> do I need to import something to use maximumBy and minimumBy?
23:52 <jle`> @hoogle maximumBy
23:52 <lambdabot> Data.List maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
23:52 <lambdabot> Data.Foldable maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
23:52 <lambdabot> GHC.OldList maximumBy :: (a -> a -> Ordering) -> [a] -> a
23:52 <jle`> they're in Data.List and Data.Foldable
23:52 Welkin joined
23:53 <scope> right
23:53 dawehner joined
23:56 oisdk joined
23:56 conal joined
23:59 alx741 joined