<    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 mkoenig joined
00:00 JeanCarloMachado joined
00:01 fizbin1 joined
00:02 <scope> geekosaur when I try to run "maximumBy (comparing snd) [(5,3),(2,7),(5,15)]" in prelude I get "variable not in scope"
00:02 <geekosaur> @index comparing
00:02 <lambdabot> Data.Ord, Distribution.Simple.Utils
00:02 <geekosaur> you want the first of those
00:02 <scope> ty
00:03 <ezyang> how would you implement https://hackage.haskell.org/package/bytestring- on String?
00:03 <ezyang> I did a simple implementation with break but it doesn't handle the empty list case correctly
00:03 <* geekosaur> keeps a browser tab open with hayoo.fh-wedel.de to look stuff like that up
00:03 <scope> geekosaur same error
00:03 newbie11 joined
00:03 <ezyang> so I'm wondering if there is a clear spec of the function
00:03 <geekosaur> then show the actual full error
00:03 event_null joined
00:03 <geekosaur> also I hope you imported maximumBy from either Data.List or Data.Foldable like mentioned earlier
00:04 <scope> yes I did
00:04 <Welkin> geekosaur: why keep a browser tab open?
00:04 <ezyang> besides special casing the empty input
00:04 <Welkin> just use the duckduckgo bangs
00:04 <geekosaur> because I use it that often?
00:04 <Welkin> !hayoo <search term>
00:04 <scope> think I've figured it out
00:05 <geekosaur> and it's silly to go through another site
00:05 systadmin joined
00:05 <Welkin> geekosaur: you type it into your address bar in your browser, as long as you have ddg set as your default search engine
00:06 <defanor> what would be the least painful way to open a file for reading and writing in text mode, read it, and then write it? hGetContents semi-closes the handle, makes it unusable for reading
00:06 <defanor> for writing*
00:06 <lolisa> Hello, typeclass question. So I have a typeclass, and I want to provide default method impl. However those impl rely on extra typeclass dependency. How can I make it so, only if those extra typeclass can be inferred, the default will be used?
00:06 <Welkin> defanor: readFile and writeFile?
00:07 <defanor> Welkin: those would open a file twice, allowing it to be changed between the calls
00:07 <ezyang> lolisa: You want "default method signatures"
00:08 <ezyang> https://downloads.haskell.org/~ghc/7.2.1/docs/html/users_guide/type-class-extensions.html "default signatures"
00:08 <geekosaur> defanor, you have to use non-lazy I/O for that
00:09 <ezyang> urk, apparently I still can't implement splitWhen correctly
00:09 <lolisa> ezyang, thx, exactly what I need.
00:10 <geekosaur> openFile, hGetLine, hSeek
00:10 <defanor> geekosaur: and non-lazy functions are just the binary ones?
00:10 <geekosaur> possibly the Buf ones if you want to use chunks that aren't lines
00:10 <defanor> geekosaur: oh, those. will try it then, thanks
00:10 <defanor> lines would be fine in this case
00:11 <Welkin> seeking a file is the worst
00:11 <Welkin> it feels too low-level
00:11 <ezyang> when a QC fails, I often want some extra debug output
00:11 <Welkin> I only do it when dealing with binary or something similar
00:11 <ezyang> what combinator do I want here?
00:11 <ezyang> oh counterexample I guess
00:11 <erisco> Cale, monochrom, ertes, et al, this is what I came up with http://lpaste.net/
00:11 <c_wraith> seeking in a file full of fixed-size records is fine. seeking in a text file is weird.
00:12 <erisco> that's right, the whole website
00:12 <erisco> okay here it is http://lpaste.net/353911
00:12 <erisco> you can see in the example it very quickly finds only the diagonal
00:13 <geekosaur> if you are shortening the file, this will suckl a bit, and I don't see a binding to truncate offhand
00:13 <geekosaur> ftruncate
00:13 <geekosaur> note that the seek here is to offset 0
00:13 <geekosaur> read file, rewrite it
00:13 <geekosaur> that should always be valid on a disk file
00:13 <erisco> which dodges the vast majority of the 10 billion factors
00:13 <defanor> there's hSetFileSize
00:14 jmiven joined
00:14 <erisco> there is the foo version and the bar version
00:14 <defanor> hrm, though hSetFileSize requires file size as an integer, and need to find how to get it from the current position
00:14 <erisco> I am still working out how this relates to other patterns, and the bar version may be a better candidate for that
00:15 <geekosaur> defanor, after the seek back to the start, you set the size to 0 and then rewrite the file which will re-extend it
00:15 <geekosaur> alternately, you use hTell after the write to find out where you are and hSetFileSize to that to drop anything left from the old version
00:15 <defanor> oh, there's hTell
00:16 <defanor> geekosaur: ah, indeed, could use that too
00:16 mda1 joined
00:17 <geekosaur> also remember to open the file for read+write initially of course
00:18 <defanor> this program where i'm just modifying an xml file turns out surprisingly awkward. used the `xml` package for xml modification, and that also turned out to be more verbose than i've expected
00:18 <geekosaur> ...and this will not be a transaction as far as the filesystem is concerned, so another process may be able to observe an intermediate state. if this matters, write to a new temporary file, close and unlink original, rename temp to name of original
00:19 ffilozov joined
00:19 <geekosaur> (most filesystems don't do transactions...)
00:20 <defanor> geekosaur: that shouldn't be an issue, actually even opening for read-write is a bit of extra care, but yup, it might actually be a better idea to do that with a temp file
00:20 mvr_ joined
00:20 <defanor> and would probably be less verbose, even
00:22 ali_bush joined
00:22 <scope> geekosaur I'm trying to use your maximumBy example, this is what I have so far but I'm unsure of where to throw parentheses. The three "5.0"s are the other 3 arguments, placeholders until I can figure out the format for minimumBy http://lpaste.net/4514503561492561920
00:22 <scope> svgHeader takes 4 arguments
00:22 <scope> whoops let me update, toPoints is missing
00:23 MrcRjs joined
00:23 <scope> http://lpaste.net/4514503561492561920
00:23 <geekosaur> maximumBy takes and returns lists. you can;t automagically unroll that list into parameters for svgHeader
00:23 <scope> I thought maximumBy returned the maximum number?
00:23 <geekosaur> wait,.. yeh
00:23 <geekosaur> I am confused by your syntax, I can;t tell what you are tryig to do
00:24 <scope> wait fuck
00:24 <scope> it returns a tuple
00:24 <geekosaur> oh
00:24 <scope> I only want the first value in that tuple
00:24 <scope> that might be what's tripping me up
00:24 <geekosaur> first off, I think you want the second version that I did but with snd replaced with fst
00:24 eacameron joined
00:24 <geekosaur> [24 23:48:54] <geekosaur> > maximum . map snd $ [(5,3),(2,7),(5,15)]
00:25 <scope> yep you're right
00:25 <geekosaur> mo more tuple, and you're also not wasting time skipping over the part you don't careabout
00:25 <scope> dammit
00:25 <geekosaur> after that you need to parenthesize
00:25 <scope> right
00:25 MrcRjs left
00:25 <scope> thank you
00:26 sdlnv joined
00:26 <geekosaur> putStrLn (svgHeader (minimum . map fst $ toPoints points) 5.0 5.0 5.0) -- I think
00:26 animated joined
00:26 <scope> geekosaur this look about right?
00:26 <scope> putStrLn (svgHeader (minimum . map fst $ (toPoints points)) 5.0 5.0 5.0)
00:26 <scope> yep exactly
00:26 <scope> well close
00:26 <scope> I guess I don't need the last pair around toPoints points
00:27 <ChaiTRex> scope: One of the nice features of ($) is its parentheses reduction.
00:27 <scope> chaitrex yeah that's actually really cool
00:27 <scope> what does $ mean in english?
00:27 <scope> roughly speaking
00:27 <Welkin> "apply"
00:27 <Welkin> it is functions application
00:27 <Welkin> function*
00:27 <Welkin> :t ($)
00:27 <scope> ah alright
00:27 <lambdabot> (a -> b) -> a -> b
00:28 <Welkin> :t const flip const id
00:28 <lambdabot> b -> (b -> c) -> c
00:28 <Welkin> :t flip (const flip const id)
00:28 <lambdabot> (b -> c) -> b -> c
00:28 <Welkin> :D
00:28 vydd joined
00:28 <geekosaur> it's function application, but instead of highest precedence it's lowest
00:28 <Welkin> I discovered that last night
00:28 zzz joined
00:29 <geekosaur> (normal being highest precedence is why your extra parentheses weren't needed)
00:29 <scope> gotcha
00:29 <scope> managed to get it working
00:29 <geekosaur> it's just id with a specialized type :p
00:30 <Welkin> lol geekosaur, that's right
00:32 nachoman joined
00:32 <erisco> I worked on generalising it and came up with qux f z = foldl (\a x -> x >>= \x' -> a >>= \a' -> f a' x') (return z)
00:33 <erisco> which is not pretty, yet
00:33 <c_wraith> :t flip (flip id)
00:33 <lambdabot> (b -> c) -> b -> c
00:33 <c_wraith> same thing but less silly. :)
00:33 <c_wraith> ie, I evaluated the const.
00:34 <erisco> qux :: (Monad m, Foldable t) => (b -> a -> m b) -> b -> t (m a) -> m b
00:34 <erisco> the type is pretty, though
00:34 bjz joined
00:34 <erisco> :t foldM
00:34 <lambdabot> (Monad m, Foldable t) => (b -> a -> m b) -> b -> t a -> m b
00:35 <erisco> can probably rewrite it with foldM
00:35 peterbec` joined
00:35 nakal joined
00:39 sophiag joined
00:41 markus1209 joined
00:41 markus1219 joined
00:42 tommd joined
00:42 <erisco> so the whole thing comes down to foldlM . ((=<<) .)
00:42 <erisco> that's my algorithm to accumulate over the factors of n-ary Cartesian product with short circuiting
00:43 <erisco> sometimes Haskell amazes me
00:44 armyriad joined
00:44 <erisco> and to boot it is more general than that
00:45 meandi joined
00:49 <ezyang> heh, Text and ByteString disagree about what the split of an empty string should be
00:49 Kallis joined
00:50 theDon_ joined
00:52 xplat joined
00:52 ericsagnes joined
00:52 doodlehaus joined
00:54 systadmin joined
00:54 djellemah_ joined
00:56 <scope> I'm trying to do something like this using the $ format if someone can help me out
00:56 <scope> " putStrLn (map edgeToSVG (convexHullEdges (toPoints points)))"
00:58 <sophiag> this seems like an obvious question, but i can't seem to find the answer to it... since parsec is jjust a state transformer monad, is it possible to use parsers like state monads? i want to cons nested lists and am thinking that might be a more sensible structure than storing them in IORefs
01:00 schell joined
01:00 <erisco> pretty sure whatever it is that IORefs is unlikely the answer
01:00 <dmj`> sophiag: you can transform parsec w/ a state monad, ParsecT
01:01 <sophiag> erisco: that's how Write Yourself a Scheme structures the repl
01:01 <scope> nevermind figured it out
01:01 <dmj`> there’s even a convenient MonadState instace for ParsecT
01:01 <erisco> that's okay, they're licensed for that
01:01 <sophiag> dmj`: cool, thanks. i'll look into that
01:03 xplat joined
01:03 carlosdagos joined
01:05 ebzzry joined
01:06 Fairy joined
01:09 <sophiag> dmj`: with MonadState would i use modifyState instead of execState as in the regular state monad?
01:09 peterbec` joined
01:10 <dmj`> sophiag: when inside of a Monad that has a MonadState constraint, you can use modify (\f -> get >>= \x -> put (f x)). When evaluating / unwrapping a state, you’d use execState
01:11 <Welkin> dmj`: hi
01:11 <sophiag> oh, ok. i only asked that because i didn't see execState listed as a method
01:11 <dmj`> sophiag: both the regular State monad and the StateT monad are instances of MonadState, so it will be inferred by the context
01:11 <sophiag> that makes sense
01:11 <dmj`> sophiag: ah yea, I think only get, put, modify are methods
01:13 <sophiag> i guess my confusion was over methods of the MonadState class versus the State monad inside it?
01:14 snowalpaca joined
01:15 <sophiag> i'm also curious about Parsec.Perm since i'm writing a nondeterministic parser. it seems the list monad has everything i need, but i just saw Perm today and am wondering about that vs. permutation and filter or guard
01:15 eacameron joined
01:15 vektorweg1 joined
01:16 tommd joined
01:16 eddygordo joined
01:17 marcopullo joined
01:18 <sophiag> the idea is simply to build up one list of nested lists and another of booleans corresponding to them and then return all the permutations with the constraints filtered out. so like a dsl for what you can achieve with one liner in the list monad
01:19 robertkennedy joined
01:20 JavaSucksMan_ joined
01:20 zar joined
01:21 twiddly joined
01:21 systadmin joined
01:22 <twiddly> /names
01:24 nomicflux joined
01:26 <nshepperd> B.split 0 (B.pack []) = [] -- nooo
01:26 FreeBirdLjj joined
01:26 xiinotulp joined
01:26 electrostat joined
01:28 joneshf-laptop joined
01:29 mda1 joined
01:29 beerdrop joined
01:31 dylex left
01:35 systadmi1 joined
01:37 <tobiasBora> Hello,
01:37 electrostat joined
01:38 wtetzner joined
01:38 eacameron joined
01:38 <nshepperd> ezyang: the text one has the convenient property that `split b (foo <> singleton b <> bar) = split b foo ++ split b bar`
01:40 badlands joined
01:40 <erisco> tobiasBora, hello
01:40 capn_freako joined
01:41 <tobiasBora> I'd like to do an efficient program that download html pages as fast as possible. For now, using parallisation on 4 cores, and using the httpLbs function, that uses one manager for all the threads, I can achieve to have 680 download per mn. However, when I look at the processor, I see that most of the time, the CPU is not used, the internet connection is not used "amazingly", and the RAM used is negligable,
01:41 <tobiasBora> so I think that my program spend most of the time by doing IDLE because he waits for the server answer... Do you have any idea on how to avoid that? I'm thinking to use pools, but... I don't know what I should put in a pool ^^'
01:41 <dmj`> sophiag: that’s a valid concern, multiple MonadState instances will be ambiguous, you might need to perform explicit lifting.
01:42 <tobiasBora> (or maybe someone has a better way to proceed)
01:43 <pacak> tobiasBora: Most likely it will be network bound and waiting for a server reply.
01:43 marsam joined
01:43 <ChaiTRex> tobiasBora: I don't know the best method, but it may be that the server isn't that fast.
01:43 <pacak> tobiasBora: Plus if you are going to hammer the same server with a ton of request - they will most likely block you.
01:43 eacameron joined
01:44 <erisco> as long as you always have a request in flight then you are already at max speed, as far as I know
01:44 <tobiasBora> ChaiTRex: The server should be fast, really. Or maybe he tried to avoid to send me info too quickly, but since I can use several proxy, I don't mind
01:44 peterbec` joined
01:45 <erisco> I mean as long as you are actively sending out a request, not waiting for a response
01:45 bjz joined
01:45 <erisco> but then responses are going to tie up time as well so I am not sure what the balance is
01:45 <tobiasBora> erisco: During the sending yes. But I think that their is time between sending and receiving, because my network use is quite low
01:48 <erisco> it sounds like you already have parallelisation set up, so if you've increased the number of parallel requests and there is no improvement I don't know what else to offer
01:48 acidjnk22 joined
01:49 <erisco> if you're hitting one host with lots of requests then it doesn't matter how fast you get them in
01:49 <erisco> you're still bottled by them
01:50 <scope> how the hell do I parenthesize this? "1" and "toPoints points" are the two arguments being passed to "pointToSVG"
01:50 <scope> printList (map pointToSVG 1 toPoints points)
01:50 <Welkin> :t map
01:50 <lambdabot> (a -> b) -> [a] -> [b]
01:50 <Welkin> it takes 2 parameters
01:51 <capn_freako> Would anyone care to share their favorite method for writing/processing literate Haskell w/ markdown?
01:51 <Welkin> printList $ (map pointToSCG) 1 (toPoints points)
01:51 <Welkin> there is one way
01:51 <Welkin> er
01:51 <scope> that's the only way to do it?
01:52 <erisco> printList (map (pointToSVG 1 (toPoints points)) by your description but this probably is not correct
01:52 <scope> yeah erisco that didn't quite work
01:52 <scope> I must be forgetting something
01:52 <erisco> I think there are 15 ways to parenthesize them
01:52 <Welkin> wait...
01:53 <erisco> so better to just know what it is you're doing than to be guessing
01:53 <Welkin> what is the type of toPoints?
01:53 <scope> toPoints :: String -> [(Float,Float)]
01:53 <Welkin> printList $ map (pointToSCG 1) (toPoints points)
01:53 kshukla joined
01:53 <Welkin> try that
01:53 <erisco> what is the type of printList and pointToSVG ?
01:53 <Welkin> pointToSVG is partially applied over 1
01:54 <scope> printList :: [String] -> IO ()
01:54 <scope> pointToSVG :: Float -> Point Float -> String
01:54 feynhat joined
01:54 <erisco> is the type of points String?
01:54 <Welkin> and I assume `type Point = [(Float, Float)]`
01:54 <scope> yeah
01:55 <Welkin> e
01:55 <Welkin> er
01:55 <Welkin> and I assume `type Point = (Float, Float)`
01:55 <erisco> okay, so toPoints points :: [(Float,Float)]
01:55 <scope> toPoints converts the string of points to a list of (float, float)
01:55 <Welkin> scope: try my suggestion
01:55 <scope> didn't work welkin
01:55 <erisco> \f -> map f (toPoints points) :: ((Float,Float) -> b) -> [(Float,Float)] -> [b]
01:55 <scope> oh fuck
01:55 <scope> you had a typo lol
01:55 <scope> one sec
01:56 <scope> that worked, is there another way to write that without using the $?
01:56 <erisco> so I think you have a problem with the function you are mapping with
01:56 <scope> printList $ map (pointToSVG 1) (toPoints points)
01:56 ph88^ joined
01:56 <scope> that works
01:56 <scope> but I want to know how to write it without the $
01:56 <Welkin> printList . map . pointToSCG 1 . toPoints $ points
01:56 <Welkin> :P
01:56 <Welkin> (printList . map . pointToSCG 1 . toPoints) points
01:56 <Welkin> er
01:57 <erisco> or I think you told me the wrong type for pointToSVG
01:57 <Welkin> (printList . map (pointToSCG 1) toPoints) points
01:57 <Welkin> (printList . map (pointToSCG 1) . toPoints) points
01:57 <scope> the . is necessary?
01:57 <Welkin> o.o damn
01:57 <erisco> maybe type Point a = (a, a)
01:57 <scope> it's confusing the hell out of me
01:57 <Welkin> scope: it is function composition
01:57 <erisco> then we're making sense
01:57 <scope> here I'll just paste the necessary functions for what I"m trying to do
01:58 <Welkin> scope: use lpaste
01:58 <Welkin> @lpaste
01:58 <lambdabot> Haskell pastebin: http://lpaste.net/
01:58 seagreen joined
01:59 <erisco> it is just printList (map (pointToSVG 1) (toPoints points))
01:59 <scope> http://lpaste.net/4514503561492561920
01:59 <scope> erisco that's exactly what I was looking for
01:59 <scope> that works
01:59 <Welkin> o.o
02:00 <Welkin> that's what I wrote
02:00 <scope> wait what???
02:00 <Welkin> just with a $ in place of the extra parentheses
02:00 <scope> wait I lied
02:00 <sophiag> dmj`: sorry, just saw your response. i'm actually still debating how to structure it. i'm not sure it makes sense to use a MonadState instance to specify constraints
02:00 <erisco> Welkin, good artists copy, great artists steal
02:00 <scope> those points are all wrong
02:00 <scope> on the html graph
02:01 <scope> wait nevermind no they aren't
02:01 <scope> yep that works
02:01 <scope> welkin I just wanted to see it without the $ :)
02:01 <scope> I'm a total haskell noob
02:02 <sophiag> dmj`: essentially after i've parsed everything i want an eval function that applies permutations to the nested lists i've built up and then filters them based on the constraints. but i'd like the option for both to apply tags or not so i can either filter all the permutations based functions that return bools or filter just the ones where the tags match
02:02 <scope> it's just the way multiple arguments are passed that was confusing me a bit
02:02 <Welkin> scope: there are not multiple arguments
02:02 texasmynsted joined
02:03 <Welkin> the maping function is partially applied over the value of 1
02:03 <scope> multiple arguments to pointsToSVG
02:03 <erisco> if you want the real answer it is that there is no such thing as multiple arguments
02:03 <scope> welkin
02:03 <erisco> all functions take exactly one argument
02:03 <scope> I'm used to being able to just to "pointsToSVG(1, (toPoints points))"
02:04 <erisco> since you've been confused by this before maybe it is time to learn how it really works
02:04 raycoll joined
02:04 <scope> erisco at the moment I need to finish this up, I'll take you up on that later though
02:04 <scope> only need to get file I/O working
02:04 <Welkin> scope: if you haven't learned about curried functions and partial application, it's an important basic concept
02:04 wtetzner joined
02:04 <Welkin> I'm sure it is coverdd in Learn You A Haskell and any other haskell resource
02:05 <scope> I have an exceptionally basic idea of curried functions
02:05 <Welkin> scope: do you know javascript?
02:05 <erisco> "exceptionally basic"
02:05 <scope> I don't
02:05 <Welkin> okay, so no es6 example
02:05 feynhat joined
02:05 <scope> I know java, c, c++ and some ruby
02:05 FreeBirdLjj joined
02:06 <erisco> out of those I think only Ruby is suitable to demonstrate in
02:06 <Welkin> function (a) { return function (b) { return a + b } }
02:06 <Welkin> there is a "curried" version of an `add` function
02:06 <erisco> or I suppose the new Java has papered over their inline class thing
02:06 <scope> ruby is the one I know the least :/
02:07 <erisco> lambdas in Java 8
02:08 <erisco> and maybe C++ has something by now... they're always adding pieces on
02:08 <scope> erisco haven't done C++ in a while either, I know C much better
02:09 <scope> welkin so curried functions are just "nested" I guess?
02:09 <Welkin> well, since none of those have first-class functions
02:09 <Welkin> it's not easy to demonstrate using them
02:09 <erisco> yeah I don't think C really has what is needed
02:09 <Welkin> which is why javascript is a good language for examples that are not haskell
02:09 <Welkin> (or lua!)
02:10 <erisco> it isn't that you cannot achieve the same effect, it is that the essence is obscured
02:10 <erisco> Lua is an abomination but JavaScript would work alright
02:10 a3Dman joined
02:10 <Welkin> erisco: o.o
02:10 dbanas_ joined
02:10 <Welkin> lua is even *better* than javascript
02:10 <Welkin> not sure why you don't like it
02:10 <mniip> 1490407766 [05:09:26] <Welkin> well, since none of those have first-class functions
02:11 <mniip> java.util.function.Function<A, B> ??
02:11 <mniip> perhaps, as a suitable approximation
02:11 <erisco> yeah with lambdas in Java 8 you can demonstrate it, I presume
02:11 tromp joined
02:11 Fairy joined
02:11 <scope> well thank you all for your help once again, I appreciate everything you all have done for me over the last couple of weeks
02:11 <erisco> without the syntax support it is obscure
02:12 <scope> but I need to head out for the night
02:12 doomlord joined
02:12 tommd joined
02:12 <mniip> new Function<Integer, Function<Integer, Integer>> { Function<Integer, Integer> apply(Integer a) { return new Function<Integer, Integer> { Integer apply(Integer b) { return a + b; } } } }
02:13 <erisco> you should be able to write (Integer a) -> (Integer b) -> a + b
02:13 <mniip> that.apply(3).apply(5) = 8
02:13 dan_f joined
02:13 <tobiasBora> erisco: Before adding threads didn't improve the result, but I tried another thing, and now I have my optimal rate at around 45 process... But I'm thinking that maybe create 45 process is not really good, so maybe I should try to create light threads instead...
02:13 coltfred joined
02:14 <Welkin> mniip: o.o
02:14 <erisco> heh, well 45 processes isn't going to do you any good
02:14 <Welkin> mniip: wtf...
02:14 <erisco> the OS will schedule processes on your cores
02:14 <erisco> it cannot schedule more processes than cores
02:14 <* mniip> has learned a bit of java over the weekedn
02:14 mounty joined
02:14 <erisco> also, your NIC can only handle so much at once
02:14 <Welkin> mniip: my condolences
02:15 <erisco> I have no idea what the limits are, but they exist
02:15 <Welkin> in es6: a => b => a + b
02:15 <Welkin> almost looks like haskell o.o
02:15 <erisco> the only reason for 45 processes would be to persuade the OS to give you more time by drowning out other processes
02:15 <erisco> but there should be a more direct way to give priority to your process(es)
02:18 conal joined
02:20 ramzifu joined
02:21 zcourts joined
02:22 conal joined
02:23 uglyfigurine joined
02:25 dbanas_ joined
02:30 dbanas__ joined
02:33 fizbin joined
02:34 JoshS joined
02:34 {emptyset} joined
02:36 fizbin1 joined
02:37 johncylee joined
02:39 nomicflux joined
02:40 cyborg-one joined
02:41 dbanas_ joined
02:45 mmn80 joined
02:46 rekahsoft joined
02:47 feynhat joined
02:48 jbiesnecker joined
02:49 <tobiasBora> I've a question about parsec
02:50 <tobiasBora> How would you check that you are at the end of the line?
02:50 peterbec` joined
02:51 <tobiasBora> I tried this (endOfLine), but it does not work on strings: http://paste.debian.net/924255
02:51 <tobiasBora> I think it's because strings do not end with \n
02:51 <sophiag> tobiasBora: you can do something like "eol = char '\n'"
02:52 TechnoTony joined
02:52 <tobiasBora> sophiag: Well, if my string do not contains '\n'?
02:52 <parsnip> try?
02:52 <tobiasBora> unexpected end of input
02:52 <tobiasBora> expecting digit or "\n"
02:53 <parsnip> there's `newline`
02:53 <tobiasBora> how
02:53 <tobiasBora> eof do the job
02:53 <sophiag> sorry, didn't look at your snippet first
02:54 <sophiag> you're saying you have multiple lines in a file and newLine isn't matching, but eof is?
02:54 <parsnip> https://hackage.haskell.org/package/parsec-3.1.11/docs/Text-Parsec.html#v:try
02:55 <parsnip> https://hackage.haskell.org/package/parsec-3.1.11/docs/Text-Parsec-Char.html#v:newline
02:56 <sophiag> oh, i think it's because when you fail on ';' it then doesn't match for newline? hence using try?
02:56 dbanas_ joined
02:56 <parsnip> maybe use manyTill for the ;
02:56 <tobiasBora> sophiag: Well I'd like a parser then match : newline, and end of input (string or file)
02:57 <tobiasBora> eof seems to work for string also,
02:57 <sophiag> i would split those into two functions
02:57 <tobiasBora> endOfLine should work for \n,
02:57 <tobiasBora> so I just need to find a way to say eof OR endOfLine
02:57 <sophiag> and then you could call many on the one that matches newline until it reaches eof
02:58 <sophiag> if you look at the csv example in Real World Haskell it basically does what you want
02:58 badlands joined
02:58 <sophiag> http://book.realworldhaskell.org/read/using-parsec.html
02:58 <parsnip> don't most filetypes end with a newline?
02:59 ChaiTRex joined
02:59 <parsnip> eof <|> endOfLine works?
02:59 <sophiag> although for some reason the RWH example doesn't use the newLine function
02:59 <sophiag> errr *endOfLine meant to say
02:59 <sophiag> but also what parsnip is suggesting should work
02:59 <parsnip> i guess the expect to not be used on windows
03:00 <parsnip> *they
03:00 <tobiasBora> eof <|> endOfLine do not compile...
03:00 hucksy joined
03:00 <parsnip> endOfLine is if someone used Notepad or Outlook to edit your file ;)
03:00 <sophiag> you need a line break
03:01 <tobiasBora> parsnip: Well noone force you to put a line break at the end of a file, and I don't want to relly on such thing.
03:01 <parsnip> maybe `try endOfLine; eof`
03:02 <sophiag> parsnip: oh, yeah. endOfLine matches for the tab character... no wonder
03:02 maarhart joined
03:03 mkoenig joined
03:03 <tobiasBora> parsnip: no: "unexpected end of input"
03:03 <sophiag> oh, no wait i mismatched comments
03:04 <parsnip> tobiasBora: maybe remove eof, just use `try endOfLine`
03:04 carlosdagos joined
03:04 <tobiasBora> Well if I don't use eof it's strange... You mean 'try endOfLine', and on the next line 'eof' ?
03:06 MP2E joined
03:06 <parsnip> i don't understand eof. if it gets to end of file, why would it say, "unexpected end of input". that seems to be the message associated with eof
03:07 <parsnip> https://hackage.haskell.org/package/parsec-3.1.11/docs/Text-Parsec-Combinator.html#v:eof
03:07 Goplat joined
03:07 <parsnip> eof = notFollowedBy anyToken <?> "end of input"
03:07 <tobiasBora> I found a solution:
03:07 <tobiasBora> ((try (endOfLine >> return ())) <|> eof)
03:07 <tobiasBora> but it's quite verbose. If you have a way to shortcut the >> return () I'd be happy to hear about it!
03:09 <sophiag> well, if you know what kind of file you're parsing you can just use either newline or crlf
03:09 <tobiasBora> sophiag: The thing is that I want to be as general as possible.
03:09 <sophiag> right, so you want both *and* eof. i get it now. sorry, exhausted so not sure i was helpful :p
03:10 <tobiasBora> When a program bug because it do not end with newline, it's crazy to debug
03:10 FreeBirdLjj joined
03:11 dbanas__ joined
03:11 mizu_no_oto joined
03:11 <parsnip> tobiasBora: how about (try endOfLine) >> eof
03:12 <parsnip> oh, somethings not sufficient about try maybe
03:12 <tobiasBora> no, it does not work
03:14 <parsnip> https://hackage.haskell.org/package/parsec-3.1.11/docs/Text-Parsec.html#v:sepEndBy
03:15 <sophiag> oh, here's an idea: "notFollowedBy endOfLine"
03:15 <tobiasBora> I've a little bit shorter version "eof <|> (endOfLine >> return ())"
03:16 <tobiasBora> sophiag: Well it would match 'a' for example ^^
03:16 <sophiag> lol, i'm saying as a way to combine endOfLine and eof
03:17 <sophiag> not sure if that will actually match endOfLine, though
03:19 FreeBirdLjj joined
03:21 peterbec` joined
03:22 <parsnip> tobiasBora: where is Parser defined?
03:22 zcourts joined
03:22 Rainb joined
03:22 <parsnip> tobiasBora: nm, i had to use your imports
03:23 <tobiasBora> parsnip: I think it's a shortcut for the long "Parse....".
03:23 <tobiasBora> ParsecT s u m Char = Parser Char I think
03:23 <parsnip> nice, i should probably take advantage of that in my code
03:23 <parsnip> i _just_ started using Parsec a few days ago
03:25 Unhammer joined
03:25 diegoksp joined
03:27 fizbin joined
03:27 tromp joined
03:28 <parsnip> what breaks if you remove eof?
03:28 Omel joined
03:29 benl23 joined
03:33 <parsnip> @hoogle m a -> m ()
03:33 <lambdabot> Control.Monad.Extra unit :: m () -> m ()
03:33 <lambdabot> Extra unit :: m () -> m ()
03:33 <lambdabot> Development.Shake unit :: m () -> m ()
03:33 <dmwit_> :t (()<$)
03:33 <lambdabot> Functor f => f b -> f ()
03:34 fizbin joined
03:34 <parsnip> tobiasBora: optional endOfLine <|> eof
03:34 <parsnip> tobiasBora: i just hoogled for type of (>> return ())
03:34 <dmwit> parsnip: eof doesn't say "unexpected end of input" if it gets to the end of file. It says it was "expecting end of input" if it does *not* get to the end of file.
03:35 <parsnip> ...
03:35 <parsnip> dmwit: ;_;
03:35 snowalpaca joined
03:35 <dmwit> I don't know that emoticon.
03:35 <parsnip> cry
03:36 <dmwit> why cry?
03:36 <MarcelineVQ> :<
03:36 <tobiasBora> dmwit: Is ()<$ supposed to be a shortcut for my >> return ()?
03:36 <dmwit> tobiasBora: yes
03:37 ebzzry joined
03:37 exferenceBot joined
03:37 <tobiasBora> so it would give something like: eof <|> (()<$ endOfLine) ?
03:37 <dmwit> yes
03:37 <tobiasBora> (it looks strange this parents
03:38 <tobiasBora> ok thank you!
03:38 <jle`> also ($> ()) if you like to keep the () on the right side
03:38 TommyC joined
03:38 <parsnip> dmwit: oh, nm, had to read that a few times, that makes sense, so i suspected, `try` has issues when it tries at end of file?
03:38 <dmwit> I haven't been following along, so I don't have a ton of context.
03:38 <dmwit> What's going bonkers again?
03:39 hexagoxel joined
03:39 <tobiasBora> ok nice thank you!
03:39 <parsnip> but `optional` is in the same library!
03:39 <Omel> So i'm a completely new to haskell i have a function that overloads the operator ## and takes two lists, i have it returning an integer (not a maybe integer) and uses guards, why does it not allow me to use fmap(+1)?
03:39 <Omel> error is Couldn't match expected type `f0 Integer' with actual type `Int'
03:39 <jle`> Omel: can you paste some code?
03:39 <jle`> it's...pretty impossible to answer without code, heh :)
03:40 fizbin1 joined
03:40 <dmwit> `optional p` and `() <$ p` do not mean the same thing. Which one you mean I leave up to you.
03:40 <Omel> https://thepasteb.in/p/DRhjq00vYMLfy
03:40 systadmi1 joined
03:40 <jle`> Omel: fmap :: (a -> b) -> [a] -> [b], here
03:41 <jle`> Omel: so it returns a list
03:41 <jle`> er i mean, it takes a list
03:41 <jle`> but xs ## ys is not a list...it's an Int
03:41 <adarqui> anyone know if ghc 8.x got "slower" .. seems my old code base takes forever to compile now
03:41 MrWoohoo joined
03:41 <dmwit> Omel: Why do you believe it should allow you to use `fmap (+1)`? What type do you expect `fmap` to have in that expression?
03:42 <Omel> isn't fmap a functor i'm incrementing the final function call by +1 until it hits 0?
03:42 <jle`> fmap isn't a functor
03:42 <jle`> do you just wnat (xs ## ys) + 1 ...?
03:42 <Omel> what is it then?
03:43 <jle`> it's a function
03:43 <jle`> it's a higher-order function that lifts a function over a functor
03:43 <jle`> > fmap (+1) [1,2,3]
03:43 <lambdabot> [2,3,4]
03:43 <Omel> no so xs ## ys would be two lists, xs would be a list and ys would be a list and it would return a count of how many elemnts it has in common
03:43 <jle`> (xs ## ys) is an Int
03:43 <jle`> xs is a list, and ys is a list
03:43 <jle`> but (xs ## ys) is an int
03:44 <tobiasBora> I've a question: I've a list of elements, but I'd like to be able to access to any of the elements in constant time. I tought to convert it in array by using something like "listArray (0:len(myList)-1) myList". Is it the good solution?
03:44 <jle`> (xs ## ys) isn't two lists; the type of (##) says that it should return an Int, not two lists
03:44 <dmwit> tobiasBora: Seems fine. What worries you?
03:45 <jle`> Omel: it is true that xs and ys are both lists. xs and ys are two lists. but (xs ## ys) is an Int
03:45 <Omel> I think i get what you're saying let me take a crack at it again and get back to you
03:45 <dmwit> I still can't parse "isn't fmap a functor i'm incrementing the final function call by +1 until it hits 0".
03:45 <tobiasBora> dmwit: Don't know, maybe some structure could be more efficient in haskell, I don't know ^^'
03:45 <jle`> dmwit: maybe they are thinking about the definition of 'functor' from Java/C++ ?
03:45 <parsnip> Omel: can you point to your definition of functor?
03:46 fizbin joined
03:46 <Omel> maybe i was misreading?
03:46 <Omel> http://learnyouahaskell.com/functors-applicative-functors-and-monoids
03:47 <Omel> In Haskell, they're described by the typeclass Functor, which has only one typeclass method, namely fmap, which has a type of
03:47 <Omel> ...
03:47 <jle`> ah yes, but fmap is not the Functor there
03:47 fred-fri joined
03:47 <jle`> [] is a Functor; Maybe is a Functor, IO is a Functor
03:47 <jle`> but fmap is not a Functor
03:47 <fred-fri> would much appreciate any feedback of how to make this solution to "the staircase problem" shorter, clearer and more elegant: https://gist.github.com/androidfred/51116c056d790c354554f253f87d33a6
03:47 <Omel> ok
03:48 xtreak joined
03:48 oaaao joined
03:48 <dmwit> Actually, `fmap` is much more the functor than the type-level mapping is. The term-level mapping induces the type-level mapping (in all categories, even), but not the other way around.
03:49 <jle`> ah, yeah. i guess fmap is a part of the functor.
03:49 Jacoby6000__ joined
03:49 <jle`> i was mixing it up with the capital-F Functor
03:49 <parsnip> i'd say there's maths functor, and haskell's functor
03:49 <parsnip> math's functor, F takes objects and arrows about
03:49 <jle`> but fmap is not quite a functor either; it's just one part of the functor
03:50 <dmwit> I don't see that substituting Functor for functor in my sentence actually makes it wrong.
03:50 <parsnip> where math's F takes objects to objects, haskell's m takes types to types
03:50 <dmwit> parsnip: Haskell types are objects in the category Hask.
03:50 <ertes> > (\n -> take n . map (\i -> replicate (n - i) ' ' ++ replicate i '#') $ [1..]) 6
03:50 <lambdabot> [" #"," ##"," ###"," ####"," #####","######"]
03:50 <parsnip> where math's F takes arrows to arrows, haskell's fmap takes, um, ... types to types?
03:50 <dmwit> (...of Haskell types as objects with Haskell functions as arrows.)
03:50 <ertes> fred-fri: ^
03:50 <jle`> well, in haskell, Functor specifically refers to the head of the typeclass instance
03:50 <dmwit> parsnip: No, Haskell's fmap takes functions to functions -- that is, arrows to arrows.
03:51 <parsnip> right, but only up in the type description, not at the function definition level, no?
03:51 <Omel> so the error was arising with fmap because fmap was returning a list when i wanted an integer?
03:51 <tobiasBora> dmwit: There is no way to deal with empty arrays?
03:51 <jle`> Omel: 'fmap f' for lists takes a list and returns a list
03:51 <dmwit> parsnip: No, right at the function definition level. If you have an arrow `f :: a -> b` then you can hand it to `fmap` to get an arrow `F a -> F b` for some Functor `F`.
03:52 <fred-fri> ertes, big thanks!
03:52 <dmwit> tobiasBora: Why not?
03:52 <Omel> ok thank you i got it working now
03:52 <jle`> Omel: so the problem was that it takes a list, but you gave it an integer
03:52 <ertes> actually
03:52 <ertes> > (\n -> map (\i -> replicate (n - i) ' ' ++ replicate i '#') $ [1..n]) 6
03:52 <lambdabot> [" #"," ##"," ###"," ####"," #####","######"]
03:52 <parsnip> dmwit: right, not sure the terminology, i guess, yes, at definition of type of function, but nothing to do with the body of the function
03:52 <ertes> > (\n -> map (\i -> replicate (n - i) ' ' ++ replicate i '#') [1..n]) 6
03:52 <lambdabot> [" #"," ##"," ###"," ####"," #####","######"]
03:52 <ertes> fred-fri: ^ better
03:52 AndChat563604 joined
03:52 <tobiasBora> dmwit: Oh sorry, I did a wrong thing. It works now!
03:52 <Omel> So would one way to fix it be doing a Maybe Int instead of a Int?
03:53 <dmwit> parsnip: I don't understand this last sentence of yours. Can you say again what your objection is?
03:53 <parsnip> dmwit: what is the terminology that separates `f :: Int -> Int` from `f x = 2 * x`?
03:53 <dmwit> I don't know. Let's say: The former is a type declaration. The latter is a definition.
03:53 <parsnip> type declaration? and body?
03:54 <ertes> > (\n -> take n . tails $ replicate (n - 1) ' ' ++ repeat '#') 6
03:54 <lambdabot> [" #####################################################################...
03:54 <dmwit> ertes: cute =)
03:54 <ertes> > (\n -> take n . map (take n) . tails $ replicate (n - 1) ' ' ++ repeat '#') 6
03:54 <lambdabot> [" #"," ##"," ###"," ####"," #####","######"]
03:54 tripped joined
03:54 <ertes> fred-fri: ^ to get a bit more experimental =)
03:55 <parsnip> right, so at one point, i had come to the conclusion (from online?) that the type declaration for fmap is where the analogy occurs for math's functor applied to arrows. whereas, not so for the function definition (body?)
03:55 <dmwit> No, the function definition is definitely still part of the analogy.
03:55 <jle`> Omel: well, you can use an Int
03:55 <jle`> Omel: you can just do (xs ## ys) + 1
03:55 <jle`> no need to involve fmap
03:55 <dmwit> The definition of `fmap` gives the computation that you should perform to map arrows to arrows.
03:55 bjz joined
03:55 <dmwit> parsnip: Perhaps we should start from the top?
03:56 <Omel> which is what i did i just was curious for the sake of knowledge
03:56 <dmwit> (I mean, when you define a functor, you have to say what the arrow mapping does, you can't just say there is one!)
03:57 <parsnip> not until you instantiate the typeclass i thought
03:57 <dmwit> Omel: Sure, or Identity Int would be even closer to the same code.
03:57 <parsnip> haskell's typeclasses, such as functor, exist with instances
03:57 <parsnip> (i'm bound to screw up the terminology/concepts, sorry)
03:57 Fairy joined
03:58 <parsnip> *exist without instances
03:58 <dmwit> ...all the definitions of fmap occur in instances, yes. So?
03:58 <dmwit> Don't confuse the *definition* of functor with the claim that "such-and-such *is* a functor" -- just like you shouldn't mix up the Functor class with particular Functor instances.
03:59 ogkloo joined
04:00 atomi_ joined
04:00 wtetzner joined
04:00 <sophiag> parsnip: it's the same definition of functor from category theory. not the same as in c++ and such, but i doubt many people think of that. unless i'm missing something here the only thing people find counterintuitive are that types are objects in hask whereas functions are morphisms
04:00 FreeBirdLjj joined
04:00 dfeuer joined
04:01 <parsnip> two functions can be the same morphism
04:01 <sophiag> so then it makes sense that fmap maps between functors since they're the only things with mappable structure, right? you can't just map between types. unless i'm confusing what this discussion is about since i stepped away
04:01 <parsnip> category theory doesn't distinguish the function bodies
04:01 eacameron joined
04:01 <parsnip> https://wiki.haskell.org/Hask
04:02 <parsnip> it only sees the type declarations
04:02 <sophiag> sure. i didn't say anything to the contrary
04:02 <dmwit> what? no
04:02 <dmwit> A category can have many distinguishable arrows between a given pair of objects.
04:02 <sophiag> dmwit: if two functions have the same type signature?
04:03 <dmwit> sophiag: Can you complete that question? "If X" ... then what?
04:03 fizbin1 joined
04:03 <parsnip> if two fmaps have the same type declaration, category theory says they are the same morphism.
04:03 <dmwit> noooo
04:03 <sophiag> no, not quite
04:04 <sophiag> they're isomorphic, which doesn't mean they're equal "on the nose" as category theory types say
04:04 <dmwit> no
04:04 <dmwit> no no
04:04 <dmwit> "same type" does not mean equal in any way, isomorphic or any other
04:04 <parsnip> oh, nm, reading more carefully now
04:04 <glguy> dmwit: What if I wanted it to ?
04:04 <sophiag> dmwit: you can't say that morphisms between the same objects are isomorphic?
04:05 <dmwit> glguy: I've got a lovely discrete category over here for your enjoyment, just 2c a pound.
04:05 <dmwit> sophiag: no!
04:05 <dmwit> sophiag: It's not even grammatical. Objects are isomorphic to each other, not arrows.
04:05 <parsnip> look, give me some credit, at least i read the bit where the types are the objects.
04:05 <sophiag> dmwit: what about in a 2-category?
04:05 <dmwit> I mean, you *can* say it. But you have to be talking about a 2-category or something where your arrows are objects themselves in some other category.
04:06 <sophiag> jinx
04:06 <sophiag> i mean, we very often are talking about a 2-category in hask right? given the use of monads?
04:07 <dmwit> elaborate?
04:08 <sophiag> well, to the extent we're talking about the "monad hierarchy" we're talking about a 2-category where monads are monoids between functions
04:09 <dmwit> You'll have to unpack that a bit for me. If you don't care to I understand.
04:09 <sophiag> i'm sorry, i think i made what you were explaining origincally unnecessarily complicated
04:10 <nshepperd> what does objects being isomorphic to each other mean?
04:11 systadmi1 joined
04:11 zeh joined
04:11 xtreak joined
04:12 <dmwit> A and B being isomorphic means there is an arrow `f :: A -> B` and an arrow `g :: B -> A` for which `f . g = id` and `g . f = id`.
04:12 <sophiag> i wasn't the one who brought that up. i said morphisms are isomorphic to another in 2-categories and monads can be an example of that
04:12 <tobiasBora> Is there any way to "open" a module only inside a function? Because it's very annoying to put Mylibrary.(+++) everywhere inside a givent function, and if I use "import Mylibrary" without the qualified, the +++ will clash with others libraries...
04:12 <sophiag> but i'm sort of testing my understanding when i get to that... if memory serves me join is the binary operator?
04:12 trudyjane joined
04:12 <dmwit> tobiasBora: No, but you can give it a short name. `import qualified MyLibrary as M`.
04:13 <ChaiTRex> tobiasBora: You can also say whatsit = MyLibrary.(+++) and not export whatsit.
04:13 <dmwit> tobiasBora: Actually, you kind of can do it. `foo = ... where (+++) = (MyLibrary.+++)`
04:13 <tobiasBora> dmwit: Yes, but for symboles it's quite annoying to prefix everything with a letter (and at the end I have lot's of letters ^^)
04:13 <dmwit> oh yeah
04:13 <dmwit> tied with ChaiTRex =)
04:13 fizbin joined
04:14 alx741 joined
04:14 <tobiasBora> dmwit: ChaiTRex : Hum, it's a good idea...
04:14 <tobiasBora> Thank you
04:14 <ChaiTRex> You're welcome.
04:14 <tobiasBora> (By the way, is there any reason not to allow this kind of local opening?)
04:14 <dmwit> No, no reason. I've wished for it often, as well.
04:15 <dmwit> Well. Unless you count implementation simplicity (and simplicity for users, too) as a reason. =)
04:15 <dmwit> There is something to be said for stupid and simple.
04:16 mbeidler joined
04:16 armyriad joined
04:17 <ertes> > (\(!)n->[(n-i)!' '<>i!'#'|i<-[1..n]])replicate 6
04:17 <lambdabot> [" #"," ##"," ###"," ####"," #####","######"]
04:17 <dmwit> Does <> have different fixity than ++ or something?
04:18 <isd> tobiasBora: Nothing wrong with the notion. Haskell's module system is pretty bare-bones in generally.
04:18 <glguy> dmwit: looks like <> is 6 and ++ is 5
04:18 wlemuel joined
04:18 <tobiasBora> dmwit: I'm not sure that's it's more friendly for the user to use "hiding" everywhere in the import section so avoid clash...
04:19 eklavya joined
04:19 <ertes> dmwit: that's historical… i had a different solution earlier, where i was using this instance: instance (Monoid b) => Monoid (a -> b)
04:19 <dmwit> ah
04:19 <ertes> but the list comprehension turned out to be shorter =)
04:20 <dmwit> tobiasBora: I think `as` is pretty handy for avoiding clashes. I use it often, and I think many other Haskellers do, too.
04:20 kadoban joined
04:20 <dmwit> If you write `BS.putStrLn` or `LBS.putStrLn` everybody in this channel is going to know exactly which module/package you meant. =)
04:21 <ertes> :t as
04:21 <lambdabot> error:
04:21 <lambdabot> • Variable not in scope: as
04:21 <lambdabot> • Perhaps you meant one of these:
04:21 <dmwit> T for Data.Text, M for Data.Map, S for Data.Set... there's a few other strong conventions but they don't come to mind immediately.
04:21 <dmwit> ertes: `import Foo as F`
04:21 <ertes> ah, that one
04:21 <dmwit> ertes: (usually also `qualified`)
04:21 <tobiasBora> dmwit: Yes, but the problems arrived if you want to be able to use some functions without adding letters before: for example it's horrible to write parsing with P. before each variable :P
04:21 <tobiasBora> *function
04:22 <dmwit> tobiasBora: That is an opinion that I no longer share.
04:22 <tobiasBora> really?
04:22 <dmwit> However I can understand that aesthetic.
04:22 <ertes> tobiasBora: you get used to it
04:22 <ertes> necessary evil
04:22 <ertes> i still maintain that haskell should just support ad hoc polymorphism
04:23 <tobiasBora> And why can't haskell "know" which function it refers to? Most of the time it's clear because of the concept...
04:24 <Sornaensis> can I install a package with stack using a .cabal file??
04:24 <dmwit> Do you have a proposal for how to know? Like, an algorithm?
04:24 <ertes> tobiasBora: haskell doesn't support ad hoc polymorphism… it will stop as soon as it sees a name clash, instead of trying to resolve it via types
04:24 <kadoban> Sornaensis: You typically don't install packages with stack, unless you mean executable. You can certainly depend on a cabal package
04:25 <tobiasBora> ertes: oh, that's what you call ad hoc polymorphism
04:25 jship joined
04:26 <ertes> tobiasBora: as soon as GHC implements -XAdHocPolymorphism, you can expect me to turn it on in pretty much every module =)
04:26 <ertes> but i don't think it will have that any time soon, so get used to those prefixes
04:27 MP2E joined
04:27 <dmwit> Such an announcement could be a good April Fool's post. =)
04:27 <ertes> i honestly would like to have that
04:27 <ertes> it would also solve the "record problem" we're apparently having
04:28 <dmwit> Do you have a proposal for how it would work that does not cause 99 other problems?
04:28 DataComputist joined
04:28 otto_s joined
04:29 <tobiasBora> Ok
04:29 caconym joined
04:29 <ertes> my proposal is: use types to resolve name ambiguity and accept, if there is only one with a fitting type, and regarding those 99 problems: deal with it =)
04:30 <tobiasBora> By the way, do you have a way to convert a string into ByteString? The pack function is only for lazy ByteString, so the workaround I see would be to do String --> Lazy Bytestring --> Bytestring, but it's not very efficient, nor nice to read
04:31 MrcRjs joined
04:31 <glguy> tobiasBora: There are two packs. One is for strict bytestrings
04:31 <kadoban> tobiasBora: The pack from the other module should do, there should be a lazy and a strict one.
04:31 <ertes> tobiasBora: what ByteString do you expect to get for "ä"`
04:31 <ertes> ?
04:31 <kadoban> Oh, ya that's a good question, disregard my answer.
04:32 <ertes> tobiasBora: remember that a String is a list of *characters*, not bytes
04:32 ericsagnes joined
04:32 <tobiasBora> ertes: I don't mind, it's plain ascii I want to convert, so it could read it as utf8, I don't mind :P
04:32 <tobiasBora> Yes I know, but some functions are waiting for bytestring, so I can't do anything else...
04:32 <trudyjane> is there a ray tracing package out there that allows the scene to be described in haskell?
04:32 <ertes> tobiasBora: why ByteString though? why not Text?
04:33 <ertes> ah
04:33 <tobiasBora> ertes: Don't know. It's for the proxy in conduit package.
04:33 <Sornaensis> kadoban: I had to reconfigure a package I got from hackage to get it to work
04:34 <Sornaensis> but I do not know how to install it with stack
04:34 <Sornaensis> so I can use it
04:34 <Sornaensis> :(
04:34 <kadoban> Sornaensis: Use it in what context?
04:34 <ertes> tobiasBora: even "it's all ASCII" has hidden assumptions, but it's usually safe to ignore that… if it's really ASCII, you can use 'pack' from Data.ByteString.Char8
04:34 <ertes> tobiasBora: a good default choice (which subsumes ASCII) would be to use the utf8-string library
04:34 <kadoban> In a stack project? You specify it in your stack.yaml file usually, you can depend on local packages or ones in git repos (on github or etc.), there's a few options, depending on what makes sense.
04:34 <Sornaensis> kadoban: install it like I might do $ stack install blorps
04:35 <Sornaensis> but with the local source
04:35 <kadoban> Sornaensis: 'stack install' is really only for executables. But if you have local source, you can go into the directory, do 'stack init' and then 'stack install' if you like.
04:36 <ertes> trudyjane: there are a few on hackage, but i think most of them have bitrotted… search for "raytrac" here: https://hackage.haskell.org/packages/
04:36 <dmwit> trudyjane: https://github.com/jtdaugherty/tracy/blob/master/src/Tracy/Types.hs#L203
04:36 <Sornaensis> kadoban: I see
04:36 <dmwit> ertes: Huh, I see just the one.
04:36 <ertes> trudyjane: and "ray trac"
04:36 <dmwit> ah
04:37 <trudyjane> ertes: Thanks : )
04:37 <Sornaensis> kadoban: is there a way to build with cabal and then install the result..?
04:37 DataComputist joined
04:37 <trudyjane> dmwit: OK, thanks : )
04:37 <Sornaensis> I'm trying to hack this together so I can see if it this package even works how I want
04:37 <kadoban> Sornaensis: Is this a library? You really should just depend on it in the relevant stack.yaml file.
04:38 <tobiasBora> ertes: Ok thank you. But the thing is that when I use "readFile", it's in string, so after I need to change everything... The lack of concensus on strings is quite annoying, each package seems to use a different version...
04:38 <kadoban> Sornaensis: 'stack init' and 'stack build' then?
04:38 <Sornaensis> kadoban: yes but the problem is the library is not configured correctly
04:38 <dmwit> Sornaensis: Just `cabal install` from within the directory that has the .cabal file.
04:38 <ertes> tobiasBora: you could use readFile from Data.ByteString
04:38 <ertes> tobiasBora: or indeed the file readers from conduit
04:38 <dmwit> Sornaensis: Wait, ignore me, I suspect I am dangerously missing context.
04:39 <kadoban> Well, not much. They asked about stack specifically, but I'm unsure why your solution wouldn't be fine for them checking if the thing builds anyway.
04:39 <kadoban> A bit unsure the actual goal.
04:40 <dmwit> I mean, `cabal install` will not make a package visible to stack probably.
04:40 <dmwit> So if continued usage of stack is part of the goal I'd be giving potentially wrong advice.
04:40 <glguy> Sornaensis: You can add this package's source directory to the packages: section of your stack.yaml
04:41 AndChat|563604 joined
04:41 Scip joined
04:42 <trudyjane> Wow, the tracy ray tracer looks good. Yep, old stuff on hackage.
04:43 <tobiasBora> ertes: ok thank you
04:44 <tobiasBora> Is there any nice way to do something like "if exists <- doesFileExist pr" ? (I'm tired of using two lines for that...)
04:44 <ertes> tobiasBora: why are you doing it in the first place?
04:45 <tobiasBora> sorry, I mean "if doesFileExist pr", with doesFileExists IO()
04:45 <tobiasBora> ertes: Well I just want to check that a file exists...
04:45 <ertes> tobiasBora: and if it does, …?
04:45 <tobiasBora> when I go in the condition
04:45 <tobiasBora> I mean:
04:46 <tobiasBora> For now I write:
04:46 fizbin1 joined
04:46 <tobiasBora> exists <- doesFileExist pr
04:46 <tobiasBora> if exists then ... else ...
04:46 <ertes> tobiasBora: i'm not asking about syntax, but about what your program actually does with that info
04:47 <tobiasBora> ertes: Well he can do plenty of things: send a message error if the file do not exists, are attribute a default value to the object build from this file...
04:48 <ertes> tobiasBora: the point is: if you're actually doing *any* other I/O with that file, you should just do that I/O in the first place and catch exceptions
04:48 <ertes> reason: there is a gap between doesFileExist and the actual I/O operation
04:49 <ertes> in other words: you need to handle exceptions anyway
04:49 <tobiasBora> Hum...
04:49 <tobiasBora> That's a good point
04:49 <tobiasBora> but for general culture, let's say that I've in place of doesFileExist a the function RandomRIO
04:50 <tobiasBora> and I want to check the the number is above a given n
04:50 felixsch_ joined
04:50 <tobiasBora> Can I avoid the two lines structure?
04:50 aarvar joined
04:50 <ertes> not if you use do/if
04:50 <tobiasBora> ok thank you
04:52 mohsen_ joined
04:55 IRCFrEAK joined
04:58 IRCFrEAK left
04:59 _IRCFrEAK joined
05:00 _IRCFrEAK left
05:04 ramzifu joined
05:04 carlosdagos joined
05:05 eacameron joined
05:07 ninegrid joined
05:07 wtetzner joined
05:07 fizbin joined
05:09 <lolisa> Hi, due to ambiguous type, I need to specialize an global function to a typeclass instance definition. Can I do that? (I can also use proxy to explicitly give type but I need a lot of Proxy then)
05:09 moongazer joined
05:10 FreeBirdLjj joined
05:11 harfangk joined
05:12 mkoenig joined
05:12 Jesin joined
05:13 brynedwards joined
05:16 uglyfigurine joined
05:16 <ertes> lolisa: paste your code, please
05:17 <lolisa> ertes, got it, just a few second, hacking it right now
05:17 <lolisa> a few minute probably :)
05:18 brynedwards joined
05:20 FreeBirdLjj joined
05:25 gabe4k joined
05:26 <Sornaensis> gah I'm still confused. I just want to build and use this library but it still won't load after I've run the build process with stack
05:26 fizbin joined
05:28 <lolisa> ertes, got it, see line 633. https://github.com/ThoughtWorksInc/DeepDarkFantasy/blob/master/src/DBI.hs
05:29 mkeyhani joined
05:30 mmachenry joined
05:30 mohsen_ joined
05:31 mkeyhani joined
05:32 hybrid joined
05:32 mmachenry1 joined
05:33 hybrid joined
05:34 fizbin1 joined
05:35 ramzifu joined
05:36 <ertes> lolisa: well, here is an immediate but minor improvement: f :: proxy (a, b, c) -> …
05:36 <ertes> f (Proxy :: Proxy (A, B, C)) …
05:37 <ertes> but of course it would be best to help the type system figure it out for itself through unification, (injective) type families, functional dependencies, etc.
05:38 mda1 joined
05:38 <lolisa> Yes, that's what I'm trying todo. Also it wont work since sub, sup are * -> Constraint...
05:39 <lolisa> (* -> * -> *) -> Constraint
05:39 xtreak joined
05:40 _sg joined
05:40 abed joined
05:41 <abed> Hi i'm having problems with my IO functionality on Haskell it cant properly store my output array and i don't know why
05:41 <ertes> for example Reify… is this class really a general relation? the type system will have no way to infer anything, unless it can unify
05:41 <abed> https://thepasteb.in/p/BghPjBoZOl2hY
05:41 <abed> if you can take a look the error occurs at test<-mednums []
05:42 <lolisa> dont worry about reify for now... It is gonna get refactored, wrong abstraction.
05:43 <ertes> abed: nitpick, but an important one: there are no arrays involved here… you're using lists
05:43 BartAdv joined
05:43 <ertes> abed: and i'm assuming that you get a "no instance" error?
05:44 <ertes> no
05:44 <ertes> an ambiguity error
05:45 <abed> the error i got was Ambiguous type variable `a0' arising from a use of `mednums'
05:45 <abed> so yes
05:45 vlatkoB joined
05:46 <ertes> lolisa: if you can't get inference to do that for you, you may find the TypeApplications extension useful
05:46 <ertes> abed: do you see why you get that error, and which particular function causes it?
05:46 <abed> i believe the reason its caused is cause im not properly inferring type from when i call test<-mednums[] i need to specify its an IO[integer] i think?
05:47 <lolisa> looking at it. right now the most painful thing is, I had to explictly use where, forall to scope the type r, can I do such implicitly?
05:47 <ertes> abed: nope (and you don't cast in haskell)
05:47 <ertes> > read "123" :: Integer
05:47 <lambdabot> 123
05:47 <ertes> > read "123" :: Rational
05:47 <lambdabot> *Exception: Prelude.read: no parse
05:47 <ertes> > read "Just (5, 7)" :: Maybe (Integer, Double)
05:47 <lambdabot> Just (5,7.0)
05:47 <ertes> abed: do you see the problem now?
05:48 fizbin joined
05:48 rektide1 joined
05:50 <abed> i need to read the IO action of mednums[] something like read mednums[] and have it recognize its a list of integers so test <- read mednums[]::[Integer]
05:51 schell joined
05:51 <ertes> abed: your reasoning is correct, although that piece of code is wrong
05:51 <ertes> abed: let n = read line :: Integer
05:52 <ertes> abed: but it would be better, if you got used to writing type signatures for top-level definitions: mednums :: [Integer] -> IO [Integer]
05:56 maarhart joined
05:56 fizbin joined
05:59 fred-fri joined
06:02 meandi_2 joined
06:06 <joneshf-laptop> What do people use for monitoring and error tracking? I only see the one New Relic library and it's years old now.
06:06 <ertes> joneshf-laptop: stderr
06:06 <joneshf-laptop> Some combination of ekg and log munging?
06:07 <joneshf-laptop> ertes, am I thinking about this idea incorrectly?
06:07 <ertes> joneshf-laptop: depends on your philosophy… mine is that logs/diagnostics should always go to stderr
06:08 <ertes> practically speaking it also helps process supervisors like s6 actually bind your logs to something useful
06:10 <ertes> that way you can establish a real logging tree with proper log handling (think of log rotation, for example, which is often done incorrectly through something like logrotate)
06:12 connrs joined
06:13 <joneshf-laptop> Hmm.
06:16 aarvar joined
06:16 hexagoxel joined
06:16 mda1 joined
06:17 halogenandtoast joined
06:20 mmachenry joined
06:20 <joneshf-laptop> Is that common?
06:21 splanch joined
06:21 osa1 joined
06:21 osa1 joined
06:21 <lolisa> Wait, can I made a member :: * -> [*] -> * typeclass?
06:21 <lolisa> * -> [*] -> Constraint
06:22 ayk joined
06:26 <glguy> lolisa: something like this? https://github.com/glguy/operations/blob/master/src/Object.hs#L70
06:27 <lolisa> glguy, just what I need.
06:29 <abed> So i need to calculate the median after receving user input atm i am sitting on top of a proper IO[Integer] should i sort and interact with that data type or is there a known way to convert from IO[Integer] to [Integer]?
06:29 <glguy> You can use your action that returns a list of Integer to make a new action that returns a single Integer, the median
06:30 <glguy> do xs <- getUserInput; return (median xs)
06:30 <ertes> joneshf-laptop: most people think that syslog is a good idea
06:31 lok joined
06:31 <abed> so are you suggesting passing the IO[integer] into a different function that parses it and generates the median?
06:35 MrcRjs joined
06:36 doodlehaus joined
06:36 SpinTensor joined
06:37 takle joined
06:40 tromp joined
06:42 gabe4k joined
06:45 splanch joined
06:48 caconym joined
06:50 takuan joined
06:51 hexagoxel joined
06:55 Xanather joined
06:56 FjordPrefect joined
06:56 takle joined
06:57 splanch joined
07:03 raichoo joined
07:05 fizbin joined
07:05 carlosdagos joined
07:09 vlatkoB_ joined
07:09 fizbin1 joined
07:11 ubsan_ joined
07:11 <cocreature> abed: write a function median :: [Integer] -> Integer and then apply it like glguy did
07:13 takle joined
07:14 connrs joined
07:15 zcourts joined
07:15 insitu joined
07:18 raichoo joined
07:18 n1k joined
07:20 greenbagels_ joined
07:20 mgu joined
07:22 qguv joined
07:23 peterbec` joined
07:23 hexagoxel joined
07:24 meff` joined
07:24 mankyKitty left
07:25 igniting joined
07:29 newbie47 joined
07:31 newbie41 joined
07:32 takle joined
07:32 MoALTz joined
07:33 sgronblo joined
07:34 AndChat563604 joined
07:38 anton__ joined
07:40 edvorg joined
07:42 splanch joined
07:45 mohsen_ joined
07:45 placidex joined
07:47 eklavya joined
07:48 dagda1 joined
07:50 placidex_ joined
07:50 ragepandemic joined
07:51 jinzhao joined
07:51 jinzhao left
07:52 henriksod joined
07:56 simukis__ joined
07:58 hexagoxel joined
07:59 kylefang joined
08:00 takle joined
08:02 igniting joined
08:02 fizruk joined
08:05 simendsjo joined
08:06 henriksod joined
08:06 wtetzner joined
08:08 Kreest__ joined
08:08 takle joined
08:08 JeanCarloMachado joined
08:09 Wizek joined
08:09 marcopullo joined
08:09 Wizek_ joined
08:10 dpn` joined
08:10 jinzhao joined
08:11 osa1 joined
08:11 osa1 joined
08:11 awang joined
08:12 <abed> https://thepasteb.in/p/98hRQ956NlDUk
08:12 <abed> how do i get main to wait on mednums to finish on the second time around
08:13 tromp joined
08:13 <abed> what happens is the first time it runs great and returns the median however, if the user presses y and calls main again it runs mednums but doesn't wait on it and continues running the rest of main
08:13 biglama joined
08:14 tommd joined
08:15 FreeBirdLjj joined
08:15 castlelore joined
08:15 dawehner joined
08:16 zar joined
08:16 takle joined
08:19 castlelore joined
08:20 fizbin joined
08:20 ragepandemic joined
08:21 awang joined
08:23 kylefang joined
08:23 <awang> :yarou hello
08:25 awang left
08:26 justicefries joined
08:27 ydnpft joined
08:29 hexagoxel joined
08:29 beckyconning joined
08:31 <adarqui> is ghc 8.0.x compilation much slower than 7.10.x? anyone experiencing slower build times with ghc 8?
08:32 Gabemo joined
08:32 <cocreature> adarqui: I don’t think I’ve seen slowdowns but if you are experiencing slowdowns definitely try to reduce it to a reasonably small example and submit a bug report!
08:33 <adarqui> well, it's more of a code size thing, not the actual performance of a compiled program.
08:34 bjobjo joined
08:34 <adarqui> code size/lines of code
08:35 <cocreature> adarqui: I’m not following. does the same problem compile significantly slower with 8.0 than it did with 7.10?
08:35 <cocreature> if you add more code it’s obviously not going to compile faster most of the time :)
08:36 <adarqui> right im saying.. say a 20k LOC project compiling under 7.10.x taking 1 minute, ghc 8 taking 2 minutes .. so i was replying to the 'reduce it to a reasonably small example' portion of your comment
08:36 <adarqui> the 'small example' is just alot of code.. heh
08:36 <cocreature> adarqui: well but maybe the slowdown is only related to parts of it
08:37 <cocreature> adarqui: it definitely sounds like a bug if the compile times doubled
08:37 <adarqui> ya i dno, just seems to be every repo i compile
08:37 <adarqui> ill setup a test/experiment between ghc 7.10.3 and ghc 8.0.2 eventually to make sure
08:38 <adarqui> but was just wondering if people are experiencing this
08:38 kylefang joined
08:38 <adarqui> https://www.reddit.com/r/haskell/comments/45q90s/is_anything_being_done_to_remedy_the_soul/
08:39 fizbin1 joined
08:39 takle joined
08:39 owiecc joined
08:41 Rizy joined
08:45 marcopullo joined
08:47 <cocreature> adarqui: yeah ghc’s compile times are not great but the only way to fix regressions is to report them when you experience them :)
08:50 leat joined
08:51 <adarqui> thanks cocreature. and ya I know... :/ it was more of a question to potentially active users of an irc channel, based on their recent experience with ghc 8.
08:52 oish joined
08:52 fizbin joined
08:53 ner0x652 joined
08:54 inad922 joined
08:56 fizruk joined
08:58 zariuq joined
08:58 fizbin1 joined
08:58 owiecc joined
09:00 a143753 joined
09:02 jinzhao left
09:06 carlosdagos joined
09:06 pylbrecht joined
09:07 wtetzner joined
09:08 JeanCarloMachado joined
09:10 ClaudiusMaximus joined
09:11 arpl joined
09:11 zcourts_ joined
09:13 gregman_ joined
09:13 t0by joined
09:17 hackebeilchen joined
09:21 curious_corn joined
09:21 sgronblo joined
09:24 Kreest_ joined
09:24 hvr joined
09:24 hvr joined
09:24 peterbec` joined
09:24 eatman joined
09:24 petervaro joined
09:25 oish joined
09:32 hexagoxel joined
09:32 schell joined
09:33 takle joined
09:34 splanch joined
09:34 castlelore joined
09:34 dawehner joined
09:36 kuribas joined
09:41 takle joined
09:41 chaosmasttter joined
09:42 tromp joined
09:43 thc202 joined
09:43 Jackneill joined
09:44 curious_corn joined
09:45 caconym joined
09:46 sgronblo joined
09:46 ChaiTRex joined
09:46 Unhammer joined
09:48 tomboy64 joined
09:48 takle joined
09:50 Wizek__ joined
09:53 FreeBirdLjj joined
09:54 uglyfigurine joined
09:55 <suppi> i'm using `stack test` to run tests but i'd like to supply arguments to the tests (such as --hide-successes) but i'm not sure how to do that
09:56 takle joined
09:56 <suppi> doing `stack test -- --args --hide-successes` returns "Directory not found --args\nDirectory not found --hide-successes"
09:56 connrs joined
09:56 <suppi> i'm using tasty btw
10:00 mohsen_ joined
10:01 takle joined
10:03 Rainb joined
10:04 <kaol> Is there a better way of writing an Int -> Text function than pack . show? It seems odd to use String for it.
10:05 Wizek_ joined
10:08 moongazer joined
10:08 ericsagnes joined
10:12 AndChat|563604 joined
10:13 fendor joined
10:15 tommd joined
10:15 danvet joined
10:16 <ertes> kaol: String should be fine in this particular case
10:17 <ertes> you may want to check out the text-show package, but i doubt that it would make a real difference in terms of speed
10:18 hexagoxel joined
10:20 gillesmajor joined
10:21 eacameron joined
10:22 sgronblo joined
10:22 takle joined
10:25 <kaol> Any speed difference will get lost in the noise in my case since this is for a web application with network and database latencies and whatnot. It just felt awkward to involve String in it at all.
10:26 anuxivm joined
10:26 peterbec` joined
10:27 <ertes> String isn't inherently bad… it's only when Strings become an actual in-memory structure that performance drops
10:27 <ertes> in the case of Show the String is produced lazily and consumed eagerly with no sharing
10:28 <kaol> And GHC is no doubt very good at optimizing things like that.
10:28 <ertes> so it pretty much compiles to a loop… if you're lucky and build/foldr fusion kicks in, then even the lazy list vanishes, leaving you with a very tight loop
10:29 <ertes> whether you're lucky in that regard depends on how 'pack' is implemented
10:29 armyriad joined
10:30 takle joined
10:30 systadmin joined
10:31 Tourist joined
10:31 Tourist joined
10:32 petervaro joined
10:32 moongazer joined
10:33 danvet joined
10:33 systadmin joined
10:38 Yuras joined
10:38 armyriad joined
10:39 roundhouse joined
10:42 <roundhouse> hi, assuming I have a type "data A { _a :: Int, _b :: ..., ... }" with defined lenses, and I'm in a "StateT A" state monad, how can I magnify (or is that even what I want) to call a function in "StateT Int"? I tried "magnify a" but I get scary type errors.
10:43 boombanana joined
10:44 <roundhouse> nvm, figured it out. I needed "zoom" instead of "magnify"
10:44 <roundhouse> thx anyway!
10:45 magneticduck joined
10:45 KongWubba joined
10:48 takle joined
10:53 exferenceBot joined
10:54 t7 joined
10:55 Rainb joined
10:56 takle joined
10:57 oish joined
10:57 Gloomy joined
10:59 dawehner joined
10:59 takle joined
11:00 eklavya joined
11:02 Nikotiini joined
11:02 psychicist__ joined
11:03 fizbin joined
11:04 mmn80 joined
11:04 simukis__ joined
11:04 augur joined
11:07 carlosdagos joined
11:09 psychicist__ joined
11:09 fizbin1 joined
11:10 kritzcreek_ joined
11:10 CurryWurst joined
11:12 Berra joined
11:12 gillesmajor left
11:15 hexagoxel joined
11:16 acidjnk22 joined
11:18 igniting joined
11:20 insitu joined
11:22 grayjoc joined
11:26 ragepandemic joined
11:27 JuanMiguel joined
11:29 epsilonhalbe joined
11:29 yellowj joined
11:30 sepp2k joined
11:32 fizbin joined
11:34 beerdrop joined
11:35 mstruebing joined
11:35 Gurkenglas joined
11:36 uve joined
11:37 <uve> hiii
11:39 scalaguy joined
11:41 scalaguy left
11:42 scalaguy joined
11:45 Nikotiini joined
11:47 cpup joined
11:50 sgronblo joined
11:53 Scip joined
11:54 lukaramu joined
11:54 tomboy64 joined
11:54 wildlander joined
11:54 wildlander joined
11:55 wildlander joined
11:57 JeanCarloMachado joined
11:58 wildlander joined
11:58 m0rphism2 joined
11:58 vydd joined
11:58 vydd joined
11:59 silver joined
12:00 saep joined
12:02 bpk joined
12:04 coot joined
12:06 insitu joined
12:06 psychicist__ joined
12:06 coot_ joined
12:09 wei2912 joined
12:09 tangled_z joined
12:09 xinming joined
12:10 hexagoxel joined
12:12 splanch joined
12:12 mustafa joined
12:13 HoierM joined
12:13 Elish joined
12:15 tommd joined
12:17 <mustafa> test
12:17 ph88 joined
12:18 dddddd joined
12:19 <ph88> hello, i'm getting a "could not deduce error" https://bpaste.net/show/8d62801bafaa line 111, i tried a few things (line 127, line 154), could anyone point me in the right direction ?
12:19 hurkan joined
12:20 <cocreature> ph88: just add the constraint to the typ signature
12:20 <cocreature> ph88: you can’t use eotTerminal without having an EotTerminal constraint
12:22 <ph88> cocreature, do i have to put the constraint on b on changeLastValue2 ?
12:22 <ph88> not sure where to put the constraint
12:22 {emptyset} joined
12:23 fizbin joined
12:23 hvr joined
12:23 hvr joined
12:23 Snircle joined
12:24 peterbec` joined
12:24 <cocreature> ph88: adding EotTerminal (Eot b) and Generic a to the constraints of changeLastValue2 seems to work
12:25 ziyourenxiang joined
12:26 fizbin1 joined
12:26 <ph88> boy o boy i'm excited let's see if it works
12:26 hackebeilchen joined
12:26 <ph88> hhmm stack is doing some updating, but i'm on a very slow connection
12:28 ragepandemic joined
12:30 splanch joined
12:32 fizbin joined
12:32 tomphp joined
12:33 pavonia joined
12:33 albertus1 joined
12:35 <ph88> Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpcomplete.com/) ... zzzZZZZzzzZZzZZzzZ
12:37 sdothum joined
12:37 <hvr> ph88: have you just updated to stack-1.4?
12:38 osa1_ joined
12:39 tomboy64 joined
12:41 nilof joined
12:43 tromp joined
12:44 leat joined
12:48 caconym joined
12:48 chenyu` joined
12:51 <ph88> hvr, no
12:51 <ph88> recv: resource vanished (Connection reset by peer)
12:51 <ph88> cute
12:51 <ph88> pretty lame that stack ghci depends on internet connection to launch stack
12:52 <ph88> 30 minutes later, still no ghci prompt
12:52 KongWubba joined
12:53 KongWubba joined
12:53 KongWubba joined
12:53 safe joined
12:54 KongWubba joined
12:55 Gurkenglas_ joined
12:56 <ph88> be right back
12:57 sgronblo joined
12:57 cfricke joined
12:58 ner0x652 joined
12:58 cfricke joined
12:58 marfoldi joined
13:00 ph88 joined
13:01 <ph88> i'm gonna open an issue over this
13:01 Arban_ joined
13:02 m0rphism2 joined
13:03 caconym joined
13:03 jchia_ joined
13:03 rumble joined
13:04 wtetzner joined
13:05 ziocroc joined
13:06 spacedog82 joined
13:06 anthonyyy joined
13:07 Lord_of_Life joined
13:08 carlosdagos joined
13:08 <anthonyyy> Very good creatures Mr
13:09 <anthonyyy> ohhh
13:09 <ph88> what's that anthonyyy ?
13:11 <anthonyyy> It does not mean anything I just put more and yyyy
13:12 JuanMiguel joined
13:12 shookees joined
13:12 shookees joined
13:13 eacameron joined
13:14 FreeBirdLjj joined
13:15 JuanMiguel joined
13:16 piyush-k` joined
13:17 noan joined
13:17 danvet joined
13:21 contiver joined
13:21 genq joined
13:22 dawehner joined
13:23 dawehner joined
13:23 sepp2k1 joined
13:24 curious_corn joined
13:25 sword865 joined
13:25 ziocroc joined
13:25 peterbec` joined
13:25 <NickHu> Does anyone here have any experience with getting foreign key support turned on with persistent-sqlite?
13:28 insitu joined
13:28 <ph88> NickHu, no, but i'm surprised that FK support is not on by default o_O
13:28 <ph88> is it ?
13:29 <NickHu> ph88: It is on by default, having just checked, but the migration that initialises the db sets it to off
13:29 ragepandemic joined
13:32 <ph88> NickHu, ah ye, perhaps there is a query you can send to turn it on
13:33 <NickHu> Any idea how? I have foreign key constraints in my schema (using persistent TH), but I guess I just need to find the flag somewhere to actually turn it on
13:33 <ph88> NickHu, i think you are talking about foreing key constraints, and not just foreign keys
13:34 <NickHu> Yes
13:34 <ph88> NickHu, https://sqlite.org/foreignkeys.html Section 2 describes the steps an application must take in order to enable foreign key constraints in SQLite (it is disabled by default).
13:35 <NickHu> But I'm using persistent to initialise my database
13:35 <ph88> what's persistent ? you can't run queries on persistent ?
13:35 lukaramu_ joined
13:36 <ph88> oh this ? https://hackage.haskell.org/package/persistent-sqlite
13:36 <NickHu> Yes
13:36 cinimod joined
13:37 Cthalupa joined
13:37 <ph88> i see this too https://hackage.haskell.org/package/persistent-sqlite-2.6.2/docs/Database-Persist-Sqlite.html#v:fkEnabled
13:37 <NickHu> Yes, it's on by default
13:37 <NickHu> I've also set it on manually with the lense, makes no difference
13:37 <ph88> not sure which function to use to send a query with this lib
13:38 <ph88> maybe this one https://hackage.haskell.org/package/persistent-sqlite-2.6.2/docs/Database-Persist-Sqlite.html#v:runSqlite
13:39 <ph88> NickHu, do you know? try to send that query
13:40 zariuq joined
13:43 robotroll joined
13:44 connrs joined
13:46 dan_f joined
13:46 splanch joined
13:46 subttle_ joined
13:47 simendsjo joined
13:47 <NickHu> Yeah, I ran the raw sql query "PRAGMA foreign_keys" and it comes back as True
13:47 simendsj` joined
13:48 <NickHu> So I guess it's just that the persistent TH schema doesn't bother to put in the foreign key constraints
13:49 simendsjo joined
13:51 caconym joined
13:52 Cthalupa joined
13:53 volume_dial joined
13:55 tromp joined
13:55 dram_phone joined
13:57 eacameron joined
13:57 stef204 joined
13:58 gugah joined
13:58 anthonyyy left
14:00 eschnett joined
14:02 FreeBirdLjj joined
14:04 eacameron joined
14:04 forker joined
14:05 eatman joined
14:07 ziocroc joined
14:07 tromp joined
14:15 FreeBirdLjj joined
14:16 tommd joined
14:19 GGuy joined
14:20 roundhouse joined
14:21 gugah joined
14:21 marr joined
14:23 <GGuy> Is there a name for a type that only has one valid instance? Eg data A = A; data B = B; data C = C A B
14:23 coltfred joined
14:23 dawehner joined
14:24 <GGuy> Its not a singleton... but it has similar properties.
14:24 mmachenry joined
14:25 <forker> C is a product type in your case, it has {A}*{B} instances
14:25 <forker> A and B are unit types, afaiu
14:26 <GGuy> Yeah but is there a name for a type where you could derive the default?
14:26 peterbec` joined
14:26 <GGuy> Because there is only one valid constuructor call
14:27 <GGuy> C A B
14:27 robkennedy joined
14:29 fizruk joined
14:30 pkmx joined
14:30 lep-delete joined
14:30 <forker> you want some sort of automatically derrivable typeclass like class WithDefaultInstance a where defaultInstance :: a ?
14:31 Mon_Ouie joined
14:32 eacameron joined
14:33 <GGuy> In my case im using ghc generics to encapsulate information into empty types. I want to be able to construct a valid instance for types that only coontain empty types at the lowest level.
14:34 <GGuy> I can do it and have most of the code but i just didnt know what to call them.
14:34 JuanMiguel joined
14:34 insitu joined
14:35 <pkmx> is it possible for ghci to ignore extensions enabled in ghci when loading files (only using those declared with LANGUAGE pragma in the source)?
14:37 nomicflux joined
14:37 zcourts joined
14:38 zerokarmaleft joined
14:38 phyrex1an joined
14:40 thunderrd_ joined
14:41 marvin2 joined
14:41 <marvin2> hi. can someone recommend me a pastebin that does not have ads for the people viewing my code?
14:43 <hpc> lpaste
14:43 <sm> http://lpaste.net, http://gist.github.com
14:43 <hpc> lpaste is run by someone who is active here
14:43 <sm> didn't he hand it off to someone ?
14:43 <hpc> formerly hpaste and specifically for the haskell community
14:43 <hpc> maybe
14:44 <hpc> i know he was involved in it fairly recently as i saw him asking in another channel about antispam techniques for it
14:44 <geekosaur> dpaste.de is another one fwiw
14:45 <lyxia> GGuy: singleton
14:46 <GGuy> Even for data C = C A B?
14:46 <lyxia> sure
14:46 <GGuy> Wicked, thanks.
14:47 serious joined
14:47 hackebeilchen joined
14:48 <lyxia> GGuy: "empty type" usually refers to types with no inhabitants like Void.
14:49 zcourts_ joined
14:54 FreeBird_ joined
14:54 augur joined
14:58 enitiz joined
14:58 mou joined
15:05 JuanDaugherty joined
15:05 anuxivm joined
15:05 dram_phone joined
15:07 Itkovian joined
15:08 carlosdagos joined
15:08 raynold joined
15:11 <dram_phone> Question: what
15:11 <dram_phone> Sorry
15:11 <dram_phone> Question: what is the correct way of doing this? http://lpaste.net/353914
15:12 <dram_phone> TypeApplications, PartialTypeSignatures, AllowAmbiguousTypes, ScopedTypeVariables -> confusion
15:13 rekahsoft joined
15:13 moongazer joined
15:14 roconnor joined
15:15 tommd joined
15:15 simendsjo joined
15:16 <c_wraith> dram_phone: all of those extensions enable talking about types more explicitly than base haskell
15:17 <dram_phone> c_wraith: You could be missing some context
15:17 <c_wraith> dram_phone: but what are you trying to do?
15:17 <dram_phone> I was trying to get http://lpaste.net/353914 to work
15:17 serious joined
15:17 <dram_phone> I want to pass the 'f' down to fmap
15:17 <c_wraith> but that code is kind of nonsense
15:17 mda1 joined
15:17 <dram_phone> but there's something I'm missing, and it doesn't really work
15:17 <c_wraith> What are you trying to do?
15:18 <dram_phone> c_wraith: arrgh, you're right, I was just trying to present a minimal example :P
15:19 jmcarthur joined
15:19 <cheater> hi
15:19 Gurkenglas_ joined
15:19 <cheater> i recently read haskell will support something similar to borrowing in the future, what is the name of that?
15:19 ebzzry joined
15:19 <Magnap> Linear types
15:20 <c_wraith> dram_phone: You at the very least need a constraint (Show f Bool) on the value
15:20 <cheater> ok
15:20 <cheater> will linear types allow us to hang up the GC?
15:20 <c_wraith> Err, (Show (f Bool))
15:20 <c_wraith> No
15:20 <cheater> why not?
15:21 <c_wraith> Because you still can allocate things with unknown lifetimes
15:21 <c_wraith> laziness being one reason for that.
15:21 <c_wraith> Complicated code being another reason
15:21 marsam joined
15:21 <cheater> sure, but what if i allocated things that will have those unknown lifetimes outside of the part that i want to perform without GC?
15:22 <cheater> and inside they will have known lifetimes
15:22 <c_wraith> The program will still have GC
15:22 <cheater> why?
15:23 <c_wraith> because it doesn't magically go away if it's not needed within a small portion of the program.
15:23 <cheater> hmm
15:23 <cheater> maybe it should..
15:23 <cheater> it would be nice if it did.
15:23 <c_wraith> You can already write code that doesn't allocate while it does useful things.
15:23 <cheater> using C FFI?
15:23 <cheater> or within pure haskell?
15:23 Welkin joined
15:23 <c_wraith> pure haskell, thanks to optimizations
15:23 nilof joined
15:24 <cheater> is there a blog post or some other write up on how to do that?
15:24 <c_wraith> If you compile something like sum [1..1000] :: Int with optimizations, it won't allocate anything.
15:24 e14 joined
15:24 <cheater> sure
15:24 <cheater> that's using fusion
15:24 <cheater> right?
15:24 <c_wraith> Yes, but fusion alone isn't enough
15:24 <c_wraith> It also auto-unboxes Int
15:24 <cheater> oh, what else is needed?
15:25 <cheater> oh
15:25 <cheater> anything else that's necessary?
15:25 <cheater> i didn't realize auto-unboxing could be used like this
15:25 <cheater> i thought it was mainly to conserve memory
15:25 <cheater> that's a nice feature, thanks for pointing it out
15:26 <c_wraith> Well, if it unboxes an Int, it fits in a register.
15:26 <c_wraith> But only a few types have that property
15:26 spatial joined
15:26 <cheater> i guess it does, but i haven't guessed the implication from "fits in a register" to "will only be held in a register"
15:27 Kundry_Wag joined
15:27 <c_wraith> That depends on the optimizer to decide it's a good idea
15:27 <cheater> what types? i guess int, float, char, and whatever bytestring holds
15:27 Sh4rPEYE joined
15:27 <cheater> aha
15:27 <spatial> How do I a logging framework in code ? I want to write to a log file.
15:28 <c_wraith> spatial: check out https://hackage.haskell.org/package/fast-logger
15:28 <cheater> it depends on your general use, you could use a writer monad, a free monad, or maybe search for a library that will do logging.
15:28 dawehner joined
15:28 <cheater> c_wraith: but during that sum, potentially a gc could still happen, right?
15:29 <c_wraith> cheater: well... no, actually. But you can call that a GHC bug.
15:29 <dram_phone> c_wraith: I was doing something like: http://lpaste.net/353915
15:29 <c_wraith> the GC can't run unless all mutator threads are suspended
15:29 connrs joined
15:29 <c_wraith> And a thread that doesn't allocate won't be suspended
15:30 <c_wraith> It's that latter part that might be considered a bug
15:30 silentcontrib joined
15:30 <dram_phone> In my case, I needed to make a general Hspec 'Spec' type that works with any 'f' type I pass to it
15:31 norotartagen joined
15:31 <c_wraith> dram_phone: why not add the Eq constraint it needs?
15:31 <dram_phone> Ideally something like {{ specFoo @MAF "My awesome functor" }}
15:31 <c_wraith> dram_phone: in fact, it lists a type there
15:32 <dram_phone> c_wraith: I thought PartialTypeSignatures could do it?
15:32 <c_wraith> dram_phone: it has 4 constraints that your type doesn't have
15:32 <c_wraith> dram_phone: those 4 constraints are necessary
15:32 uglyfigurine joined
15:32 ompaul joined
15:33 <dram_phone> c_wraith: so you mean the (_) part doesn't work?
15:33 <c_wraith> dram_phone: no, _ stands for an unspecified set of type constructors, but constraints are different.
15:33 MindlessDrone joined
15:34 nomicflux joined
15:35 _sras_ joined
15:35 <cheater> c_wraith: aha
15:36 yangjay joined
15:36 <dram_phone> c_wraith: I was expecting this to kick in: http://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extra-constraints-wildcard
15:37 <c_wraith> dram_phone: huh. Ok, that looks like it should have applied - maybe it doesn't play nicely with ambiguous types
15:39 <c_wraith> dram_phone: because the error says it is calculating the constraints on prop_fmap correctly
15:40 <c_wraith> dram_phone: I bet the problem is actually with the type application. I think it's not using that information when calculating the constraints on check_prop_fmap
15:40 gugah joined
15:41 <dram_phone> c_wraith: But when I say (Functor f, _) on check_prop_fmap, it actually gets the rest of the constraints right: http://lpaste.net/353915#a353917
15:42 <dram_phone> And somehow it's *still* ambiguous
15:42 <c_wraith> well yes, it's ambiguous. That's expected.
15:42 <c_wraith> the type *is* ambiguous
15:42 <dram_phone> c_wraith: But then even AllowAmbiguousTypes doesn't let me pass
15:43 <dram_phone> Because, I suppose, the 'main' error is 'Could not deduce (Eq (f0 C))'
15:43 <c_wraith> are you using check_prop_fmap anywhere?
15:43 raycoll joined
15:44 <dram_phone> c_wraith: not really
15:44 alx741 joined
15:44 <c_wraith> dram_phone: so, the thing to note here is that it's complaining about f0, not f
15:44 <c_wraith> So somehow, those aren't being unified
15:45 <dram_phone> Appending {{ main = check_prop_fmap @[] }} didn't help
15:46 <c_wraith> dram_phone: as an aside, you know you don't even need to check that property, right? With the way Haskell's type system works, if fmap id === id holds, the composition property is automatic
15:47 <dram_phone> That one I know :)
15:47 <dram_phone> I'm checking something else, that's just a minimal example
15:47 <c_wraith> got it
15:48 <dram_phone> c_wraith: Basically, I want to use partial sigs because Eq constraints are everywhere in props
15:49 MrHulk joined
15:49 <dram_phone> And I want to use TypeApplication because I heard it solved the 'passing a type easily' problem
15:49 <dram_phone> (Proxy is ugly)
15:50 urodna joined
15:51 <c_wraith> I think it's likely you've hit a corner case in the interaction of all of those features - particularly type application, which is quite new
15:53 Itkovian joined
15:53 <dram_phone> c_wraith: Yeah
15:54 <c_wraith> If you drop partial signatures or type application, does everything work?
15:54 <dram_phone> Judging from the sudden appearance of those constraints, I think the typechecker actually lost track them somewhere
15:54 mizu_no_oto joined
15:55 Berra joined
15:56 gugah_ joined
15:57 <dram_phone> c_wraith: Hmm TypeApplication is actually irrelevant
15:57 _sg joined
15:58 cpup joined
16:01 tromp joined
16:02 tommd joined
16:02 aarvar joined
16:03 robertkennedy joined
16:03 gugah__ joined
16:05 <dram_phone> c_wraith: If I write all the constraints on check_prop_fmap, everything works
16:05 <c_wraith> dram_phone: with type applications?
16:05 <dram_phone> As soon as I wildcard one constraint, it breaks down
16:06 <c_wraith> This is "report ghc bug" territory. At the very least, the documentation is wrong. :)
16:06 <dram_phone> c_wraith: no, it fails even without using type applications
16:07 <dram_phone> You're right. Let's at least just see what the mighty GHC devs think
16:09 Nik05 joined
16:09 shayan_ joined
16:09 <NickHu> Is anyone here familiar with lenses?
16:10 <c_wraith> NickHu: several people are. go ahead and fire off the question. :)
16:10 Zialus joined
16:10 badlands joined
16:10 <NickHu> What's the idiomatic way to write something like (^. myField) <$> headMay recordList?
16:11 <NickHu> Where I want to get a Maybe Field, i.e. Just $ head recordList ^. myField providing it's nonempty
16:12 <glguy> recordList ^? _head . myField
16:14 spacedog82 joined
16:14 desktop joined
16:16 takle joined
16:16 eacameron joined
16:16 oish joined
16:20 nomicflux joined
16:21 RegEchse joined
16:22 tushigushi joined
16:27 peterbec` joined
16:27 <greymalkin> What is the appropriate way to take a (a -> Maybe b) and lift it into a (a -> MaybeT m b)? I can't hoogle up a similar function, but it seems like it would be a common use case.
16:30 yogsotot_ joined
16:31 <joneshf-laptop> If you know your `m` is `Applicative` you could roll your own.
16:32 <joneshf-laptop> :t \f -> MaybeT . pure . f
16:32 <lambdabot> error:
16:32 <lambdabot> • Data constructor not in scope: MaybeT :: f0 a -> c
16:32 <lambdabot> • Perhaps you meant variable ‘maybe’ (imported from Data.Maybe)
16:32 <joneshf-laptop> :t \f -> Control.Monad.Trans.Maybe.MaybeT . pure . f
16:32 <lambdabot> Applicative m => (a1 -> Maybe a) -> a1 -> Control.Monad.Trans.Maybe.MaybeT m a
16:33 uglyfigurine joined
16:33 <greymalkin> Well, technically, I just need `Maybe a -> MaybeT m a`
16:33 <joneshf-laptop> drop the `f` then.
16:33 <joneshf-laptop> :t Control.Monad.Trans.Maybe.MaybeT . pure
16:33 <lambdabot> Applicative m => Maybe a -> Control.Monad.Trans.Maybe.MaybeT m a
16:34 epsilonhalbe joined
16:34 <greymalkin> Huh... I tried that with `return` and got nowhere.
16:35 <joneshf-laptop> Maybe it'd help to look at the type of `MaybeT`?
16:35 <joneshf-laptop> :t Control.Monad.Maybe.MaybeT
16:35 <lambdabot> error:
16:35 <lambdabot> Not in scope: data constructor ‘Control.Monad.Maybe.MaybeT’
16:35 <lambdabot> No module named ‘Control.Monad.Maybe’ is imported.
16:35 <joneshf-laptop> :t Control.Monad.Trans.Maybe.MaybeT
16:35 <lambdabot> m (Maybe a) -> Control.Monad.Trans.Maybe.MaybeT m a
16:36 <joneshf-laptop> Or maybe it'd help more to see what you had tried previously, if you're available to share it.
16:36 <greymalkin> Right. I may have messed up my parens.
16:36 <greymalkin> I would love to, but it's been overwritten a number of times now;
16:36 <joneshf-laptop> :) No worries.
16:37 <joneshf-laptop> `return` should work similarly, just give a more restrictive constraint.
16:37 <joneshf-laptop> :t Control.Monad.Trans.Maybe.MaybeT . return
16:37 <lambdabot> Monad m => Maybe a -> Control.Monad.Trans.Maybe.MaybeT m a
16:38 cobreadmonster joined
16:38 ikke joined
16:38 Velpoman joined
16:38 gienah joined
16:38 ragepandemic joined
16:40 heebo joined
16:41 mmachenry joined
16:42 conal joined
16:44 jrajav joined
16:46 marsam left
16:47 ChaiTRex joined
16:48 BlueRavenGT joined
16:49 moongazer joined
16:50 robkennedy joined
16:50 texasmynsted joined
16:52 dawehner joined
16:53 marcopullo joined
16:53 simukis__ joined
16:55 dawehner joined
16:55 zcourts joined
16:56 albertus1 joined
16:58 mimi_vx_ joined
16:59 yogsotot_ joined
16:59 takle joined
17:00 badlands joined
17:00 yogsotot_ joined
17:02 yogsotot_ joined
17:03 zar joined
17:03 krypton_ joined
17:04 SpinTensor joined
17:04 Gurkenglas_ joined
17:07 takle joined
17:09 carlosdagos joined
17:09 inad922 joined
17:11 e14 joined
17:17 Goplat joined
17:17 jluttine joined
17:20 takle joined
17:20 thunderrd_ joined
17:20 _sras_ joined
17:21 <_sras_> How can I answer questions like "Which version of Servant contains the NT function" ?
17:22 ichor joined
17:23 marcopullo joined
17:24 Zialus joined
17:24 coltfred joined
17:25 <cocreature> _sras_: look through the hackage docs and see where it exists?
17:26 iomonad joined
17:26 mizu_no_oto joined
17:27 <_sras_> cocreature: Look through Hackage docs for all the versions?
17:27 <cocreature> _sras_: yeah, I don’t think there is really any other way that’s guaranteed to be accurate
17:27 moongazer joined
17:27 <_sras_> cocreature: Is there any way to search through functions within a specific package?
17:28 <_sras_> or package + version
17:28 sz0 joined
17:29 cyborg-one joined
17:29 <cocreature> _sras_: I don’t think so. you can probably generate hoogle databases separately for each version and then use that to search but that’s slightly annoying
17:30 <_sras_> cocreature: Don't people usually have this problem?
17:30 <t7> @hoogle (a -> m b) -> (c, a) -> m (c, b)
17:30 <lambdabot> Data.Tuple.HT mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
17:30 <lambdabot> Data.Tuple.Lazy mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
17:30 <lambdabot> Data.Tuple.Strict mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
17:31 <greymalkin> _sras_: Have you tried :info NT within ghci?
17:31 <cocreature> _sras_: usually I don’t. I tend to just stick to the newest version of dependencies
17:31 <cocreature> _sras_: in the case of servant it is definitely in 0.10, but I’m not sure which version added it
17:31 <_sras_> greymalkin: I don't have NT available in my ghci.
17:33 kau joined
17:34 <thoughtpolice> _sras_: I normally look at the index if you know the name. http://hackage.haskell.org/package/servant-0.10/docs/doc-index-N.html
17:35 <thoughtpolice> _sras_: However, a slight bit of digging showed that in Servant 0.10, the 'NT' constructor from the 'natural-transformations' package was re-exported. That's where "NT" comes from.
17:35 <_sras_> thoughtpolice: Yes. Got it.
17:35 <thoughtpolice> _sras_: So, you should be able to either import Servant.Utils.Enter in Servant >= 0.10, or simply always import http://hackage.haskell.org/package/natural-transformation-0.4/docs/Control-Natural.html
17:36 mson joined
17:36 sepp2k joined
17:36 moth joined
17:38 dawehner joined
17:39 thunderrd joined
17:42 theelous3 joined
17:46 ragepandemic joined
17:47 <t7> @hoogle (Map k v) -> [v]
17:47 <lambdabot> Data.Map.Internal elems :: Map k a -> [a]
17:47 <lambdabot> Data.Map.Lazy elems :: Map k a -> [a]
17:47 <lambdabot> Data.Map.Strict elems :: Map k a -> [a]
17:47 oish joined
17:48 Sonderblade joined
17:48 insitu joined
17:49 osa1 joined
17:49 osa1 joined
17:55 <_sras_> Why does I get the stack error "No extra dep settings found for package at x.y.z" ?
17:56 jao joined
17:57 <joneshf-laptop> Asking again since it's a different time of day: What do people use for monitoring and error tracking? I don't see anything for NewRelic for instance.
17:57 anmin joined
17:58 yogsotot_ joined
17:59 <t7> how do iwrite tests with a standard stack setup
17:59 adlaistevenson joined
17:59 <joneshf-laptop> There's ekg, but I don't see a nice way to connect that to other services.
17:59 <joneshf-laptop> So do you roll your own monitoring with ekg?
17:59 <thoughtpolice> joneshf-laptop: Lots of people use systems like ElasticSearch with logging frameworks IME, but maybe that's a bit of a different answer than you're looknig for. NR is a bit odd because it has a big proprietary SDK, right? So you need FFI.
17:59 <thoughtpolice> ekg does have a statsd backend, fwiw. There's also some stuff to push it into Prometheus and stuff too, I believe
18:00 IanKelling1 joined
18:00 <joneshf-laptop> ES for logging?
18:00 <joneshf-laptop> that's interesting. Do I not understand what ES is used for?
18:00 <thoughtpolice> Well, you throw all your logs into ElasticSearch and aggregate from there, I mean.
18:01 <thoughtpolice> ElasticSearch is traditionally very 'bespoke' though, lots of setups are complex. That's why it might not be really what you're looking for
18:01 <joneshf-laptop> K, I wont spend too much time on it then.
18:01 <thoughtpolice> It's not really in the same space as something like timeseries or metric data, though. There's a statsd and Carbon(?) backend for ekg if you want something like that.
18:01 <geekosaur> ES for logging sounds like trying to reinvent Splunk
18:01 <joneshf-laptop> But if you have any links, I'll book mark them for later.
18:02 <geekosaur> then again, with how much Splunk costs, one can see why]
18:02 <thoughtpolice> geekosaur: Yes, that's basically what people try to do, and exactly for that reason :)
18:02 curious_corn joined
18:03 anuxivm left
18:03 <thoughtpolice> joneshf-laptop: https://github.com/ocharles/ekg-carbon and https://hackage.haskell.org/package/ekg-statsd for starters
18:03 <joneshf-laptop> So, we're using NewRelic on our Rails monolith. I'm wondering if there'ssomething similar I can use for a HAskell service we're writing.
18:03 handyc joined
18:04 <joneshf-laptop> Something that'd give us history, uptime metrics, performance, etc.
18:05 handyc left
18:05 prophile joined
18:05 <joneshf-laptop> thoughtpolice, thanks! will check it out.
18:05 <thoughtpolice> joneshf-laptop: Yeah, NewRelic's integration is actually application level which makes it difficult. It's not impossible but it's trickier because you'll have to do, like, FFI. Unless they changed this to use like, HTTP recently, it was a C/C++ library you had to link in for this
18:05 <thoughtpolice> (That's why it can do things like monitor DB transactions and all that fancy crap 'easily')
18:06 <joneshf-laptop> Yeah, I'm really not interested in writing C bindings.
18:06 <thoughtpolice> There are alternatives perhaps. Something like DataDog might be more to your liking and it's more like, a really, really super kickass version of collectd, kind of?
18:06 yogsotot_ joined
18:06 <thoughtpolice> Integrating with it for your own stuff is fairly well supported, I think?
18:07 insitu joined
18:07 caconym joined
18:07 MarioBranco joined
18:09 <thoughtpolice> joneshf-laptop: If you're married to NewRelic though, yeah, you might have to hunker down and write some basic FFI interop. :/
18:09 eacameron joined
18:10 Oct joined
18:10 Oct left
18:11 e14 joined
18:11 ertesx joined
18:12 falafel joined
18:13 aradia joined
18:13 orbifx joined
18:14 mada joined
18:15 dawehner joined
18:17 takuan joined
18:17 ryandevilla joined
18:17 netheranthem joined
18:19 <NickHu> Does anyone know how to throw away a record field when deriving a generic ToJSON instance?
18:20 Sh4rPEYE joined
18:20 danvet joined
18:20 <Sh4rPEYE> Hi, I'm trying to build Brittany using stack, but I keep getting errors about missing type constructors or types...
18:20 <Sh4rPEYE> https://github.com/lspitzner/brittany
18:21 <Sh4rPEYE> Brittany seems much nicer than hlint, at least for my small files
18:21 <sm> do you mean than hindent ?
18:22 <sm> or stylish-haskell ? I think those are more comparable
18:22 <sm> looks interesting, I wonder how it improves on those
18:23 dawehner joined
18:24 peterbecich joined
18:24 <ocharles> joneshf-laptop: these days I use prometheus
18:25 nepiktaz joined
18:25 <thoughtpolice> sm: Most importantly, it should support all of GHC's frontend features. hindent and stylish-haskell both are lacking here, and it's very important in practice. (Maybe the work done in brittany will help them in the long run, however)
18:25 Luke joined
18:26 Luke joined
18:26 eacameron joined
18:27 <ryandv> is it possible to write an instance of Bifunctor for Data.Map?
18:27 <sm> thoughtpolice: nice!
18:28 <ryandv> I am thinking something like `bimap f g m = map g (mapKeys f m)`, but `mapKeys` enforces `Ord k` for `Map k v`
18:28 peterbec` joined
18:28 <cocreature> ryandv: you can’t for that exact reason
18:28 <ryandv> and I'm not sure how to bake this constraint into my instance, since Bifunctors are kind `* -> * -> *`
18:28 <ryandv> I see
18:28 connrs joined
18:28 <cocreature> ryandv: that’s also why there is no Functor instance for Set
18:28 sedeki joined
18:29 <joneshf-laptop> thoughtpolice, thankfully, we're not really stuck with it. I just think it'd be nice for everybody if we could have all of our monitoring in one place.
18:29 dsh joined
18:29 <ryandv> cocreature: ok, very good to know... thanks
18:29 IanKelling1 joined
18:29 <joneshf-laptop> ocharles, these days? What have yu used in the past, and how does prometheus compare?
18:30 <Sornaensis> how do I install a local package as a library using stack? I just want to be able to pull it in automatically when I am working with it, but using `stack install` just creates a .stack-work directory and the documentation does not tell me how to make it available
18:30 <joneshf-laptop> I guess the question I should be asking is less, which tools shoud I use, and more, "What's important to monitor?"
18:31 <sm> Sornaensis: stack install will also have installed it to your user packages, see: cd; stack exec -- ghc-pkg list
18:33 <sm> you can depend on it more explicitly in a project by including your local package in the packages or extra-deps list in the project's stack.yaml
18:33 chaosmasttter joined
18:34 <Sornaensis> sm: it only places it in the directory I ran stack in
18:34 <Sornaensis> so it is not available outside there or something
18:35 <sm> perhaps I'm wrong then.. run the stack install in your home directory
18:35 oisdk joined
18:36 <sm> if you want it there. But really, declaring the dependency will be more robust
18:36 kadoban joined
18:36 rcat joined
18:36 <Sornaensis> I'm just running a script. declaring a dependancy says it can't find the package
18:37 Glooomy joined
18:37 <sm> https://haskell-lang.org/tutorial/stack-script is a good way to handle that (or newer stack script command)
18:37 <tangled_z> hey, could anyone help me with a stack error I'm getting?
18:37 <Sornaensis> sm: this is a package I am installing from local source
18:37 <Sornaensis> not from the remote repos
18:37 <Sornaensis> I just want the behavior to be the same
18:38 <Sornaensis> instead, it installs the local library into the package directory
18:38 MP2E joined
18:38 ryandevilla joined
18:39 oberstein joined
18:39 <sm> Sornaensis: did I help yet, or...
18:40 tromp joined
18:43 <adlaistevenson> tangled_z: What sort of stack error?
18:44 <Sornaensis> sm: If I install a package from the remote repos with `stack install <hackage package>` and then run a script through stack that uses that package, it works. If I build my local library located at ~/project/foo/bar, my script cannot find it, because stack does not actually install it to ~/.stack
18:44 orbifx joined
18:44 <adlaistevenson> tangled_z: (I won't of much help, but it would seem more conducive to resolution if you gave detail.)
18:45 <sm> Sornaensis: what if you do cd; stack install ~/project/foo/bar
18:46 <Sornaensis> error parsing targets: directory not found
18:46 Gloomy joined
18:46 <Sornaensis> err, no local directories found as children
18:47 dylukes joined
18:47 CurryWurst joined
18:47 Gloomy joined
18:47 <sm> what about: cd; stack install --stack-yaml ~/project/foo/bar/stack.yaml
18:47 <t7> anyone used hspec? i need to conditionally run another rest only if the first bit passed
18:48 feuerbach joined
18:48 Gloomy joined
18:48 <sm> no.. actually I don't know how to force it to install libraries to ~/.stack. Might be a #haskell-stack question
18:49 zar joined
18:49 Gloomy joined
18:49 <benzrf> where does fusion happen in during the compilation process, in ghc? i used -ddump-simpl, and the Core has a bit of code that looks blatantly fuseable to me
18:49 marcopullo joined
18:49 <benzrf> is it just that fusion happens after -ddump-simpl, or is ghc not as good at fusion as i assumed?
18:49 <Sornaensis> sm: it would have been nice if the architecture of stack is explained somewhere in all the documentation. I was expecting it to work like cabal which does install everything including local packages to the same location
18:49 <Sornaensis> sm: that command does the same thing as before
18:49 Gloomy joined
18:50 <Sornaensis> it makes a .stack-work dir in the project dir
18:50 <sm> right
18:50 <sm> stack install only installs executables at user level it seems
18:51 <Sornaensis> :(
18:51 <sm> maybe you need to mention your local package in packages or extra-deps list in ~/.stack/global/stack.yaml
18:54 <* sm> is mystified
18:54 <Sornaensis> I just don't understand what the difference is between running stack install <local> vs stack install <remote>
18:54 <ryandv> @pl (\x -> x)
18:54 <lambdabot> id
18:54 chaosmasttter joined
18:54 <ryandv> @pl (\x -> f x >>= (\y -> g y))
18:54 <lambdabot> (g =<<) . f
18:54 <Sornaensis> @pl (\x -> y)
18:54 <lambdabot> const y
18:55 <mauke> :t (\f g x -> f x >>= g)
18:55 <lambdabot> Monad m => (t -> m a) -> (a -> m b) -> t -> m b
18:55 lyuha joined
18:55 <mauke> :t (>=>)
18:55 <lambdabot> Monad m => (a -> m b) -> (b -> m c) -> a -> m c
18:55 <ryandv> interesting
18:55 <ryandv> I never understood the kleisli arrow
18:56 <sm> stack install is just stack build --copy-bins
18:56 <ryandv> s/arrow/composition
18:57 <ryandv> mauke: I have been illuminated, thanks
18:59 e14 joined
18:59 arpl left
18:59 raycoll joined
18:59 oisdk joined
19:00 chewzerita joined
19:00 <Sornaensis> sm: this is super obnoxious then.
19:01 <sm> I'm curious, I've asked #haskell-stack
19:02 <sm> if that doesn't work, opening a bug against stack will
19:04 <Sornaensis> sm: I got it to work by building with ghc and specifying the stack.yaml file
19:04 <Sornaensis> but that's so obnoxious to do when I just want to run some scripts...
19:04 Jesin joined
19:05 Sh4rPEYE joined
19:07 <tangled_z> adlaistevenson: I'm trying to install a package that's not on hackage, so I've included it in my stack.yaml. however when I do "stack build", it installs all the dependencies, and while it's compiling the package it breaks
19:07 robotroll joined
19:07 oisdk joined
19:08 <adlaistevenson> tangled_z: Breaks without an error?
19:08 <tangled_z> adlaistevenson: the error it gives me is a type error in one of the files of the library
19:08 <tangled_z> "Couldn't match expected type Int with actual type "Control.Distributed.Process.Extras.Time.Timeinterval"
19:09 <tangled_z> Weirdly I've succeeded at installing this library before
19:09 {emptyset} joined
19:10 <MarcelineVQ> tangled_z: likely you need an extra-dep: true flag on the location https://docs.haskellstack.org/en/stable/yaml_configuration/#local-dependency-packages-extra-dep
19:10 carlosdagos joined
19:10 leat joined
19:11 marcopullo joined
19:13 <tangled_z> MarcelineVQ: I've tried adding that flag already, but it still happened. (The library I'm downloading is included in my Main.hs file and my .cabal file)
19:13 aib joined
19:14 bbcue joined
19:15 whatareyou joined
19:15 <sm> Sornaensis: you'd think this would work, but it has corrupted my package db: cabal install --package-db=`stack path --local-pkg-db` ~/localpackage
19:15 prkc joined
19:16 raycoll joined
19:17 e14 joined
19:18 permagreen joined
19:18 MrWoohoo joined
19:19 Rotaerk joined
19:20 caconym joined
19:20 augur joined
19:20 m0rphism2 joined
19:21 Sh4rPEYE joined
19:21 ragepandemic joined
19:24 raycoll joined
19:25 <cocreature> I keep being confused by the fact that to get MonadThrow I need to import Control.Monad.Catch
19:25 ChaiTRex joined
19:26 <adlaistevenson> tangled_z: Maybe one of the libraries made a breaking change to the version the consumer code is pulling? Maybe you could open an issue with that lib on github?
19:26 osa1 joined
19:27 grayjoc joined
19:31 tangled_z joined
19:31 cmsmcq joined
19:32 cmsmcq left
19:33 Icewing joined
19:33 badlands joined
19:34 <ryandv> is there a dictionary type like Data.Map that is also an instance of Bifunctor?
19:34 e14_ joined
19:34 whatareyou left
19:35 <glguy> Probably not, Bifunctor would require it to work on keys of any type
19:35 ragepandemic joined
19:35 <davean> glguy: well, [(a, b)] seems it would allow it?
19:36 eacameron joined
19:36 <davean> er, no equality
19:36 <davean> I mean, but you can force the equality on the lookup function side
19:36 <glguy> No, that type would be fine, and it would also be a crummy Data.Map replacement in general
19:36 robertkennedy joined
19:36 <davean> glguy: It is a dictionary type though
19:36 <glguy> OK
19:36 e14 joined
19:37 <ryandv> is there no way to constrain the first type argument to Data.Map to have a "conditional" Bifunctor instance? like `Ord a => Ord [a]`
19:37 <davean> ryandv: then it wouldn't be Bifunctor
19:38 <glguy> ryandv: No, the point of bifunctor is that it works for any type
19:38 <glguy> You'd need to make a different typeclass
19:38 insitu joined
19:38 <ryandv> I see.
19:38 <davean> ryandv: and you pretty much have to bake that into the class declaration, consider for a moment what happens if you don't
19:41 peterbec` joined
19:43 aarvar joined
19:45 takle joined
19:47 curious_corn joined
19:47 psychicist__ joined
19:50 Itkovian joined
19:52 t0by joined
19:52 t0by joined
19:55 drewr joined
19:55 ChaiTRex joined
19:56 ego joined
19:56 Unhammer joined
19:57 slack1256 joined
19:57 marcopullo joined
19:57 Guest4561 joined
19:57 Guest4561 left
19:58 <slack1256> Anyone using nixpkgs and has luck to use wx to compile correctly?
20:00 Sh4rPEYE joined
20:00 <Sh4rPEYE> What does 'Fun' in QC do? I'm supposed to somehow use it to test second Functor law with my custom Functors; but I have no idea how to use it. COuld somebody help?
20:01 dan_f joined
20:02 takle joined
20:02 jmcarthur joined
20:02 eacameron joined
20:05 rekahsoft joined
20:08 eacameron joined
20:09 sssilver joined
20:12 ryandevilla joined
20:13 tromp joined
20:14 fizruk joined
20:15 robkennedy joined
20:15 tangled_z joined
20:15 Scip joined
20:19 yogsotot_ joined
20:20 bodisiw joined
20:21 <lyxia> It's a trick to generate and print functions
20:21 coltfred joined
20:21 osa1 joined
20:22 jdm06 joined
20:24 katychuang_ joined
20:24 <lyxia> Sh4rPEYE: If you have a property on functions, instead of writing quickCheck $ \f -> prop f, which won't typecheck, you can write quickCheck $ \(Fun _ f) -> prop f
20:26 tromp joined
20:27 <Sh4rPEYE> It seems my understanding of QC is more shallow than I've foreseen (I have no idea what does it mean o have a property on functions). Is there any good tutorial I should read?
20:28 kvothe joined
20:28 <kvothe> @search wifikill apk
20:28 <lambdabot> Unknown command, try @list
20:28 nak joined
20:29 <nak> does a monad need to implement map/join/ap etc to be a monad ?
20:29 <nak> or is only bind/return the bottom line requirement ?
20:30 <nak> the monad laws only talk about relationship of bind and return, so i'm guessing only bind/return is absolutely necessary
20:30 gleblobanov joined
20:30 eacameron joined
20:30 <katychuang_> Are there libraries focused on charting? There's diagrams for drawing graphics, but wondering if there are libraries that already can take data and produce charts. (Specifically would like to know if there are libraries for heatmaps)
20:30 oish joined
20:31 <Maxdamantus> nak: are you talking about monads in general, or the type classes that exist in Haskell?
20:31 sedeki joined
20:32 <cocreature> katychuang_: I know that https://hackage.haskell.org/package/plots- supports heatmaps. not sure about the various other plotting libraries on hackage
20:33 gabe4k joined
20:33 eacameron joined
20:34 dagda1 joined
20:34 <rdesfo[m]> any one able to get haskell to work in orgmode with intero?
20:34 mmachenry joined
20:34 <nak> Maxdamantus: i'm asking about monads in general
20:35 <katychuang_> cocreature: thanks! that looks like it might fit my needs
20:35 <thoughtpolice> Chart is also a good one, and uses Diagrams in the background actually like plots, but doesn't have Heatmaps built in, it seems.
20:35 <geekosaur> nak, currently join is reconstructed from bind; there's work to break that relationship so you can implement join and use fmap from the Applicative instance, instead of bind
20:36 <Maxdamantus> nak: in general, you'd just need to be able to derive a set of operations like bind/return
20:36 <geekosaur> ap is constructed from bind as well; or you can use the Applicative instance's version. (these are supposed to match, otherwise your Monad instance is wrong)
20:37 Itkovian joined
20:38 <nak> geekosaur: mm ok
20:38 <nak> geekosaur: how is pure different than return for State ?
20:39 <nak> it seems like they do the same thing?
20:39 <geekosaur> pure should never be different from return
20:39 <nak> ah ok ^_^
20:39 <geekosaur> basically, return predates Applicative
20:39 farrioth joined
20:39 <geekosaur> and Applicative as prerequisite for Monad is quite recent, so Monad is still phrased in terms of its own return
20:40 e14 joined
20:40 <nak> gotcha
20:41 chrissl joined
20:41 <Nolrai> Is there a word for two functions (f:a->b,g:b->a) that may or may not be inverses?
20:41 merijn joined
20:41 <geekosaur> if we were to throw out the existing Mon ad and start over, return and bind (the things you currently have to define for Monad!) would not exist; we'd use pure and join, and make you specify join in the Monad instance
20:41 <nak> so when someone says "pointed functor", geekosaur, does that somehow relate to the pure function?
20:41 <geekosaur> yes
20:41 <geekosaur> Pointed is Functor + pure
20:41 <Nolrai> The pure is the point, IIUC.
20:42 <nak> my understanding is "a pointed functor is just a functor that has a way of getting a value into the functor, aka pure"
20:42 <nak> ok cool ^_^
20:42 <geekosaur> if you also add "apply" then you have Applicative
20:42 <merijn> geekosaur: Why do you say bind wouldn't exist and we'd use join? Join is widely considered "more cumbersome to implement"
20:42 <Nolrai> It is?
20:43 <Nolrai> I can not think of a single instance where that is true...maybe cont?
20:43 <geekosaur> I was under the impression that bind often does what people want in a single package, vs having to use join . fmap
20:44 <geekosaur> but join itself is not more cumbersome to implement, just more cumbersome to use vs. bind
20:44 <Nolrai> Well yes. Thats why you would define it as "join . fmap".
20:44 <geekosaur> but bind can be derived given join and fmap
20:44 <merijn> geekosaur: Well sure, but so can join, so that's not such a great argument
20:45 feuerbach joined
20:45 feuerbach joined
20:45 <jle`> i heard the issue with join being in monad is that GeneralizedNewtypeDeriving has issues with deriving it
20:45 <Nolrai> In practice I find Join significantly simplier to define.
20:45 <jle`> it depends on the specific instance
20:45 ij joined
20:45 <Nolrai> Fair.
20:45 <ij> Is Seq a -> [a] really "foldr (:) []" and isn't implemented already?
20:45 <geekosaur> but the main reason I;'d start with jon is the mathematical correspondence. then bind can be in the typeclass with a default implementation
20:46 yogsotot_ joined
20:46 <jle`> ij: i'm not sure what you're asking
20:46 <nak> i understand bind can be derived from map+join but i usually like seeing the implementation of each
20:46 <nak> this is probably because i'm a noob tho and still cutting my teeth
20:46 <geekosaur> (more practically I suspect we'd get either one definable in terms of the other)
20:46 <jle`> are you asking if there is a Seq a -> [a] function in base?
20:46 <jle`> there is, it's toList
20:46 <jle`> are you asking if it's implemented as foldr (:) [] ?
20:47 <jle`> are you asking if it's equivalent to foldr (:) [] ?
20:47 <ij> jle`, Where is it then? There's no Data.Sequence.toList.
20:47 <jle`> it's in Data.Foldable
20:47 simendsjo joined
20:47 <ij> Ah!
20:48 <jle`> although i think it'd be fai to expect it to be re-exported
20:48 <jle`> *fair
20:48 e14 joined
20:49 mstruebing joined
20:49 zcourts joined
20:51 justan0theruser joined
20:51 athan joined
20:52 azahi joined
20:53 tangled_z joined
20:53 m0rphism3 joined
20:55 arpl joined
20:55 dolio joined
20:56 <MarcelineVQ> :t (putStrLn "foo" >> return "as") <> (putStrLn "wah" >> return "bs") -- neat
20:56 <lambdabot> IO [Char]
20:58 <merijn> MarcelineVQ: Yeah, attoparsec also has a Monoid instance on it's parsers, it's nice :)
21:00 gleblobanov joined
21:00 <MarcelineVQ> some nice stuff coming in base 4.10 as well
21:00 ludat joined
21:01 insitu joined
21:02 <merijn> MarcelineVQ: Oh? Such as?
21:02 gleblobanov joined
21:02 insitu joined
21:02 maarhart joined
21:04 <MarcelineVQ> min/maximumBy are going to use foldl1 now, liftA2 is becoming part of Applicative ( https://ghc.haskell.org/trac/ghc/ticket/13191 ), and Bifoldable/Bitraversable are coming to base
21:05 <MarcelineVQ> Lots of other things as well but they're out of my useage domain, so far
21:06 drewr joined
21:10 <cocreature> oh I think I was complaining about minimumBy using foldr just the other day
21:10 <MarcelineVQ> someone was for sure so that made the line more noticeable
21:11 carlosdagos joined
21:11 <cocreature> so who do I need to complain to to get sum to use foldl'? :)
21:14 <MarcelineVQ> idk much about that, is this post relevant to the subject? https://ghc.haskell.org/trac/ghc/ticket/10830#comment:26 is only mentions sum at the end so I'm not sure how directly applicable it is for you
21:14 simukis__ joined
21:15 <cocreature> MarcelineVQ: yep seems relevant thanks
21:18 t0by joined
21:22 splanch joined
21:22 Twey joined
21:24 <Jinxit> is there a function that would turn [a, b, c] into a <|> b <|> c?
21:24 <merijn> Jinxit: foldr? :p
21:24 gugah joined
21:25 <Jinxit> well sure :p
21:25 <merijn> "foldr (<|>) empty"
21:25 <Jinxit> oh true
21:25 psniper joined
21:25 <merijn> Or msum, if you have MonadPlus
21:26 <merijn> Or asum if you have Alternative, I suppose
21:26 <glguy> :t asum
21:26 <lambdabot> (Alternative f, Foldable t) => t (f a) -> f a
21:26 tromp joined
21:27 ryandevilla1 joined
21:29 newbie20 joined
21:29 maarhart joined
21:29 <newbie20> Hello, do typeclass resolution/typefamily calculation get memoized?
21:30 <merijn> lolisa: What do you mean by that?
21:31 acidjnk joined
21:31 eacameron joined
21:31 <lolisa> So let's say it take quite some time to infer an instance of a typeclass. That particular instance will get inferred alot. Will ghc save the infer result to avoid doing the same work again and again?
21:33 <merijn> lolisa: What? You mean at compile time?
21:33 cpup joined
21:34 <lolisa> Yes.
21:34 <michi7x7> momoization is never at compile time?
21:34 <merijn> lolisa: Why would it end up inferring things a lot?
21:34 eacameron joined
21:34 jao joined
21:35 <merijn> Also, type inference is like a trivial amount of work, compared to most other things it's doing
21:35 <lolisa> I mean, does ghc internally save the result of type class inference.
21:35 maarhart joined
21:35 <Nolrai> > 1+2
21:35 <lambdabot> 3
21:36 <lolisa> So I am trying to do finally tagless, but I also have:
21:36 Itkovian joined
21:37 Rotaerk joined
21:37 <lolisa> data Term con h x = Term (forall r. con r => r h x), in which con is the "Language" of the term. (r is Eval/Show/Optimization, for example)
21:37 oisdk joined
21:37 <geekosaur> michi7x7, you may be mixing levels...
21:38 <michi7x7> geekosaur: yeah, just realized that this really is about compile time. never bothered about that though
21:38 rcat joined
21:39 <lolisa> However I need subtyping for con when I try to do instance Lang (Term Lang) - this instance is not extensible, and I need to replace it with Lang (Term con) where con is arbitary "subtype" of Lang
21:39 <lolisa> I cameup with an ok algorithm for that, but it will probably get inferred alot, and it's not very eifficent, so it will be best if GHC save the result
21:40 klumpskin joined
21:40 <klumpskin> Where can I find some information on how haskell handles expression evaluation and precendence?
21:41 <geekosaur> how haskell handles it, or how ghc handles it?
21:41 <glguy> precedence as in how + and * interact in 1 + 2 * 3 ?
21:41 eacameron joined
21:41 maarhart joined
21:42 Sh4rPEYE joined
21:42 <glguy> https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-820061
21:42 peterbec` joined
21:42 Sh4rPEYE joined
21:42 <lolisa> geekosaur, GHC.
21:42 <glguy> for operators in general you can check in GHCi with :info
21:42 <klumpskin> how ghc handles it, yes like + and * and stuff
21:42 EvilMachine joined
21:42 xtsee joined
21:43 <lolisa> sry, nvrmind
21:43 <geekosaur> lolisa, that was intended for klumpskin
21:43 <lolisa> Yes, sorry
21:43 <klumpskin> Like I mean how ghc implements or what a good way to implement it is
21:43 <geekosaur> I cna't speak to yours because I can;t tell whether you are talking abotu a type level computation, or are confusing ghc-compile-time with your language's "compile time"
21:44 <klumpskin> uh
21:44 <klumpskin> compile time
21:44 <geekosaur> and that one was for lolisa :) I see I;m being confusing
21:44 <klumpskin> oh lol
21:45 <geekosaur> klumpskin, https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler is where you start for how ghc does things. I don't know where it documents what it does with precedence though
21:45 <klumpskin> thanks
21:45 <lolisa> no, I am talking totally about GHC.
21:45 <phz_> hey, I’m looking for documentation on stack’s package.yaml
21:45 <geekosaur> since Haskell has user defined operators and doesn't require you to put the fixity with the operator definition, ghc fixes up precedence after the fact
21:46 <lolisa> So you can Imageine that I am doing singleton by hand, and somehow I feel like computing pow 3 5 a hundred time. will pow 3 5 get compute one or 100 time?
21:46 eacameron joined
21:46 <phz_> ah it’s hpack, nevermind
21:47 wtetzner joined
21:47 <geekosaur> klumpskin, so I checked the parser part of the commentary and it mentions that fixing precedence is done in the renamer
21:47 <geekosaur> "Sometimes the over-generous parsing is only dealt with by the renamer. For example: Infix operators are parsed as if they were all left-associative. The renamer uses the fixity declarations to re-associate the syntax tree."
21:47 <Cale> lolisa: I'm not sure I understand what you mean, can you write the code?
21:48 <lolisa> Yes, just a few minutes.
21:48 <klumpskin> ah ok cool :) thanks geekosaur!
21:48 <Cale> lolisa: Functions are not memoised by default -- doing that would result in basically no garbage collection ever happening (because very little would ever be garbage)
21:48 <phz_> is there a way to have ghc’s output colored?
21:48 <phz_> I can’t stand it like that
21:49 <phz_> almost all languages’s compilers have that feature :(
21:49 <geekosaur> not yet
21:49 <phz_> dah :D
21:49 <klumpskin> phz_: there are libraries that can do that
21:49 eacameron joined
21:49 <phz_> yeah, I tried one once
21:49 <phz_> but I was very deceived about it
21:49 <klumpskin> like pretty-print a derived Show with formattign and colors
21:49 <phz_> it fucked up ghc’s output pretty much
21:49 <klumpskin> oh lol
21:49 <merijn> That's why I use trifecta for parsing now, pretty coloured output :p
21:50 <phz_> merijn: I don’t see how you get ghc’s output colored by using trifecta
21:50 <phz_> I want colors when I hit stack build
21:50 <michi7x7> I need some inspiration from you guys. I'm trying to come up with an Haskell CTF-challenge (a challenge for hackers liek crackmes). The idea is to host a buggy service and the challenge is to find and exploit that bug. In C you would usually allow a stack-overflow error which is exploitable using a return-to-libc attack. I need ideas for such a chellenge in Haskell :)
21:50 <merijn> phz_: That was a mostly orthogonal remark, relating too "almost all compilers have coloured output"
21:50 <klumpskin> michi7x7: have you looked at smashthestack?
21:50 <lolisa> I mean, typefamily at compile time... No runtime is ever involved. But anyway let me write the code :)
21:51 <klumpskin> You can probably do the same kind of challenges but with target programs written in Haskell
21:51 <klumpskin> But haskell probably has a lot less of those kinds of bugs than c
21:51 <phz_> merijn: I see
21:51 <phz_> though, I don’t get why no one is working on that
21:51 <* geekosaur> notes that the last CTF did have a Haskell challenge... but it was more along the lines of "valid Haskell program that is also valid GIF"
21:51 <geekosaur> I said "not yet" for a reason
21:52 <phz_> it’s so great to have the errors in red .D
21:52 <phz_> :D *
21:52 <phz_> geekosaur: is someone working on it?
21:52 <michi7x7> klumpskin: yeah, something like that, but we are trying to host our own wargame and there are very little Haskell-challenges
21:52 <geekosaur> Idon't think anything is making 8.2 but it is being worked on
21:52 <phz_> great!
21:52 <geekosaur> the whole error/warning system is gradually being worked over, color support is intended to be part of it
21:52 <geekosaur> along with finer control over them
21:52 <merijn> phz_: Simple answer: The people hacking on GHC don't consider it important and would rather invest there time in more complicated things
21:52 <phz_> merijn: yeah sorry
21:53 <phz_> I now think as a rustacean
21:53 mrjake joined
21:53 <phz_> like « everyone can push a PR »
21:53 <phz_> :D
21:53 <merijn> phz_: Also, stuff like "fancier output", etc. is something that's relatively easy for people to dive in
21:53 <geekosaur> there is apparently already some simple color support in patches, as I said unlikely to make the next release though
21:53 hiratara joined
21:53 <phz_> merijn: well, I’d love to help
21:53 <merijn> phz_: Well, everyone *can* contribute
21:53 <geekosaur> and if you'd like to help out, #ghc is the place to be
21:53 nomicflux joined
21:53 <phz_> thanks for pointing out! <3
21:54 <geekosaur> although right now not many people will pay attention because they're working on getting 8.2 prerelease out
21:54 <merijn> phz_: In fact, this is the sort of stuff better done by people starting out. Stuff like coloured output does not require a lot of understanding about hard bits (e.g., the type checker), it just requires doing stuff and investing time
21:54 <michi7x7> klumpskin: the first level of the amateria-wargame is related to python and cPickle which has a well-known security problem when unserializing objects. Something like that in Haskell would be nice
21:54 <merijn> phz_: Also, see this brief and incomplete intro: https://gist.github.com/merijn/c01405e6c5a78a1c4ccb
21:55 <geekosaur> https://ghc.haskell.org/trac/ghc/wiki/Newcomers
21:55 <bjs> merijn: there's always low-hanging fruit in compilers
21:55 <merijn> I'm not sure whether the phabricator stuff changed
21:55 <phz_> well, I’ve been using haskell for more than four years now
21:55 <phz_> but never found the time to contribute to ghc
21:55 <merijn> bjs: Well, GHC especially so, since it's starved for contributors, so all the core people are too focused on doing "Real Work"
21:56 <mrjake> Has anyone used the Exference library? It seems like there should be a function String -> String which takes a type signature and returns the haskell code which implements it, but I can't find it.
21:56 <phz_> how long is the build?
21:56 <merijn> (not to say the small low hanging fruit isn't worth doing...one should never underestimate the incremental awesomeness of minor fixes)
21:56 <phz_> I’ve been contributing to rustc, and the build is awfuly long
21:56 <phz_> awfully*
21:56 <klumpskin> michi7x7: this might be useful: https://wiki.haskell.org/Safely_running_untrusted_Haskell_code
21:56 <merijn> phz_: Depends on your machine? full build of GHC takes about 1-2 hours here
21:56 <phz_> merijn: ok, that seems a normal compile time
21:57 <merijn> phz_: But the compiler is built incrementally, so depending on what you work on it's faster after that
21:57 <Cale> phz_: It's long the first time, but if you're working on it, you'll tend to have most of it compiled already.
21:57 <MarcelineVQ> the first build takes awhile, subsequent builds aren't awful, if you're building devel it's not optomised as well iirc so it doens't take too long
21:57 <bjs> merijn: there's lots of really nice usability things that all compilers could do with, especially in the area of error reporting that can *always* be improved, the core team never have time for and are simple enough for newcomers (usually)
21:57 <MarcelineVQ> 1-2 hours sounds like optomised
21:58 coot joined
21:58 <michi7x7> klumpskin: well, there is this: https://artyom.me/haskell-ctf, but this seems awfully constructed
21:58 <merijn> phz_: Also, might wanna subscrube to ghc-devs mailing list in addition to joining #ghc
21:59 <michi7x7> it uses Language.Haskell.Interpreter and sanitized the input against the most common exploits, but "forgets" some
21:59 <merijn> phz_: People usually somewhat responsive on both
21:59 <phz_> dully noted, merijn :)
22:00 <phz_> thank you for your responses
22:00 <merijn> People are already working on errors messages, so might wanna coordinate with whoever is doing that.
22:00 eacameron joined
22:02 <fresheyeball> lets say I want to install a kde theme
22:02 dddddd joined
22:02 <fresheyeball> should I install it the standard way by unpacking into a folder?
22:02 <fresheyeball> or is it worth it to do it with nix?
22:03 Lord_of_Life joined
22:03 <* geekosaur> wonders why ask here?
22:03 <* phz_> wonders the same thing as geekosaur
22:03 <merijn> geekosaur: Maybe they just join the top channel?
22:04 <merijn> Or one or more of the top channels
22:04 <fresheyeball> geekosaur: I was not aware nix was a panacea, so I asked.
22:04 <geekosaur> fresheyeball is something of a regukar here.my guess is the nix/stack integration comes up enough to suggest easy help with nix here?
22:05 <fresheyeball> crap sorry
22:05 splanch joined
22:05 <fresheyeball> I am in the wrong channel
22:09 CurryWurst joined
22:09 fizruk joined
22:10 bodisiw joined
22:12 lonelynoobcoder joined
22:12 psychicist__ joined
22:13 eacameron joined
22:17 splanch joined
22:17 <hvr> merijn: another reason ppl may not care about coloring ghc output is that emacs' haskell-compile mode does the coloring for you
22:17 rotaerk joined
22:18 <hvr> merijn: that being said, ghc-8.2 does have support for coloring compiler messages... but it's not perfect
22:18 deepfire joined
22:18 <merijn> hvr: Well, that just means we need volunteers to work on it until it is ;)
22:20 splanch_ joined
22:21 Destol joined
22:22 oisdk_ joined
22:24 splanch joined
22:28 <lolisa> Cale, https://gist.github.com/MarisaKirisame/419f2250dda1d8c0528cc702ec783b98
22:30 <Cale> lolisa: Oh, this is a very different situation than I thought you were asking about before :)
22:30 oisdk joined
22:30 <lolisa> Sry for the confusion, but somehow I have some code that repeatly calculate expensive typeclass/typefamiliy.
22:30 <Cale> I'm going to guess that it absolutely will recompute it every time that you write it like that
22:31 hiratara joined
22:31 <Cale> Now, what you might want to try (I have no idea if it'll work) is to define a type synonym for (Pow (S (S (S Z))) (S (S (S Z)))) and see if it computes the value of the synonym just once
22:32 <lolisa> But how do I 'see'? do I just test the run time or look into the source code?
22:33 <glguy> We need a Trace :: Symbol -> k -> k :)
22:33 arquebus joined
22:34 Supersonic112 joined
22:36 govg joined
22:38 Goplat joined
22:41 Welkin joined
22:42 johnmendonca joined
22:47 fred-fri joined
22:47 <fred-fri> would much appreciate any advice on how this can be improved https://gist.github.com/androidfred/26296cb7d2ef624ed2500f64eea62cdb
22:47 Voldenet joined
22:47 Voldenet joined
22:49 <michi7x7> fred-fri: well, comp looks like a fold to me. other than that, I think it's very readable
22:51 <fred-fri> right, i was thinking it was probably a better idea to create an array of tuples of alice and bobs scores and then fold them into their respective points
22:52 HaskellLord69 joined
22:52 Gloomy joined
22:56 <michi7x7> fred-fri: smth like this? https://gist.github.com/michi7x7/c92b75a66ba48d0cc214dca751470245
22:59 Fairy joined
23:00 <fred-fri> michi7x7, nice. i was thinking of, after parsing into [[1,2,3], [1,2,3]], transform that into [(1,1), (2,2), (3,3)] and then fold that.
23:00 <geekosaur> > transpose [[1,2,3], [1,2,3]]
23:00 <lambdabot> [[1,1],[2,2],[3,3]]
23:01 <fred-fri> cool thanks, lemme see if i can put that together
23:01 deepfire joined
23:02 nakal_ joined
23:03 e14 joined
23:04 Edith joined
23:05 Rotaerk_ joined
23:06 byorgey joined
23:06 byorgey joined
23:08 mson joined
23:08 whiteline joined
23:10 yogsotot_ joined
23:10 bodisiw joined
23:11 <michi7x7> fred-fri: https://gist.github.com/michi7x7/c92b75a66ba48d0cc214dca751470245
23:11 <michi7x7> it should be possible to extend that to more than 2 lines :)
23:11 carlosdagos joined
23:11 dawehner joined
23:14 sgronblo joined
23:14 curious_corn joined
23:16 marsam joined
23:17 systemfault joined
23:17 JeanCarloMachado joined
23:21 kav joined
23:22 doodlehaus joined
23:23 <Jinxit> so i'm using Earley and i want to combine multiple Prods with <|>. however, when all of them fail, i want it to fall back to another Prod. is it idiomatic to just add it with another <|> and have ambiguous parses? or do i have to create the "not" version of my options?
23:26 <fred-fri> michi7x7, https://gist.github.com/androidfred/26296cb7d2ef624ed2500f64eea62cdb see the comment with the new code, i'm doing something wrong with the fold because it's not compiling
23:26 caconym joined
23:26 stevebash joined
23:27 tromp joined
23:31 <michi7x7> fred-fri: yeah, a tuple is not a list
23:31 <michi7x7> :t transpose
23:31 <lambdabot> [[a]] -> [[a]]
23:34 <fred-fri> duh im an idiot
23:34 eazar001 joined
23:34 splanch joined
23:36 <Sornaensis> is `par` generally useful for stuff there does not seem to be much documentation about how it works or what disadvantages of using it there might be
23:36 eacameron joined
23:38 <michi7x7> fred-fri: this works with more than 2 lists: https://gist.github.com/michi7x7/c92b75a66ba48d0cc214dca751470245
23:40 <michi7x7> Sornaensis: there is a very good tutorial on parallel Haskell somewhere, can't find it though
23:41 <MarcelineVQ> http://chimera.labs.oreilly.com/books/1230000000929/index.html
23:42 <michi7x7> yeah, thats it ^ :)
23:42 <Sornaensis> thanks
23:42 <* Sornaensis> reads
23:43 featherlessbiped joined
23:43 <fred-fri> michi7x7, can't thank you enough for showing me all these different options and pointing out what i'm doing wrong! how can this one be made to output the desired? https://gist.github.com/androidfred/26296cb7d2ef624ed2500f64eea62cdb
23:43 <fred-fri> (bottom comment)
23:44 peterbec` joined
23:44 peterbecich joined
23:44 contiver joined
23:45 augur joined
23:48 MindlessDrone joined
23:49 <michi7x7> :t foldl
23:49 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
23:50 <michi7x7> fred-fri: ^ the fold-function (first argument to foldl) takes the current count as first argument and the list element as second argument
23:51 h3nnn4n joined
23:52 <michi7x7> fred-fri: also: you're comparing list-elements in comp' and incrementing those. you want to increment your counter
23:53 Fairy joined
23:53 bsmt joined
23:54 CaptainBland joined
23:57 mda1 joined
23:59 <parsnip> how do i convert bytestring to UTCTime? convert to string, then to int, then to utctime?