<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 _2_5 26 27 28 29  
00:07 vaibhavsagar_ joined
00:14 skeet70 joined
00:17 newhoggy_ joined
00:21 netheranthem joined
00:59 aarvar joined
01:05 netheranthem joined
01:06 baweaver joined
01:08 dni- joined
01:14 conal joined
01:15 abhiroop joined
01:18 earldouglas left
01:25 dennisvennink joined
01:36 seagreen joined
01:39 newhoggy joined
01:41 Youmu joined
01:55 systemfault joined
01:56 Durbley joined
02:02 takle joined
02:13 takle joined
02:37 abhiroop joined
02:42 Rodya_ joined
02:48 mac10688 joined
02:53 takle joined
02:54 exferenceBot joined
02:56 meandi joined
02:57 tnks joined
02:57 conal joined
02:57 dni- joined
02:58 hexagoxel joined
03:04 vaibhavsagar joined
03:06 hiratara joined
03:26 takle joined
03:31 aarvar joined
03:34 hphuoc25 joined
03:41 hphuoc25 joined
03:43 takle joined
03:56 malaclyps joined
04:00 conal joined
04:01 takle joined
04:04 Rodya_ joined
04:08 uglyfigurine joined
04:18 abhiroop joined
04:19 takle joined
04:20 govg joined
04:25 <mac10688> https://stackoverflow.com/questions/43533947/getline-within-list-comprehension
04:25 <mac10688> if anyone knows the answer, I would appreciate it
04:28 <glguy> mac10688: [ getLine | y <- [0..4]] isn't a function, is your goal just to produce an action that reads 5 lines from that?
04:28 <glguy> There's sequence [ getLine | y <- [0..4]], and there's replicateM 5 getLine
04:29 takle joined
04:29 <glguy> but you won't be executing getLine from inside the *list* comprehension
04:30 <mac10688> i'm working on a codeingame problem. I want to build a matrix using a list comprehension. I get the values by using the getLine function
04:30 <mac10688> and using a list comprehension is the only way I know to keep up with the index so I can mutate the cells into coordinates
04:31 <mac10688> I think the sequence thing is doing the trick!
04:32 <mac10688> this is awesome, thanks!
04:36 seagreen joined
04:36 takle joined
04:37 govg joined
04:46 dni- joined
04:50 takle joined
04:55 mengu joined
05:00 <Cale> mac10688: If you haven't looked at how sequence is implemented, it might be quite instructive
05:00 <Cale> mac10688: The basic idea is that we want to turn a list full of IO actions into a single IO action which will run them all, and collect up a list of the results
05:00 newhoggy_ joined
05:01 <Cale> sequence [] = ... -- in the case that there are no actions, we want to produce an action which does nothing, except to result in an empty list, so that's what return will get us:
05:01 <Cale> sequence [] = return []
05:02 <Cale> sequence (x:xs) = ... -- in the case of a nonempty list which starts off with x...
05:02 <Cale> sequence (x:xs) = do v <- x; ... -- we'll first run x, getting some result v
05:02 <Cale> and now we want to run the rest of the list of actions, collecting up a list of results -- thankfully, we have a perfectly good function to do that:
05:02 <Cale> sequence (x:xs) = do v <- x; vs <- sequence xs; ... -- the function we're writing of course
05:03 <Cale> and then we just need to put the initial result and the rest of the results together:
05:03 <Cale> sequence (x:xs) = do v <- x; vs <- sequence xs; return (v:vs)
05:19 abhiroop joined
05:20 <mac10688> Oh thanks Cale , I'm just now seeing your response
05:20 abhiroop joined
05:21 <mac10688> I've worked through sequence in the haskell book, but I guess it's been a while and I wasn't used to seeing it in action with an IO monad. It's still not totally intuitive but let me see
05:22 <mac10688> that's a smooth implementation, totally makes sense now
05:23 takle joined
05:32 yellowj joined
05:36 takle joined
05:44 mstruebing joined
05:45 abhiroop joined
05:47 abhiroop joined
05:50 takle joined
05:51 ThomasLocke joined
05:51 ThomasLocke joined
05:54 abhiroop joined
05:58 takle joined
05:58 uglyfigurine joined
05:59 abhiroop joined
06:01 ali_bush joined
06:01 ali_bush joined
06:03 trudyjane joined
06:09 Gurkenglas_ joined
06:11 takle joined
06:14 <eatman> Hi! Good morning.
06:14 ali_bush joined
06:14 ali_bush joined
06:14 abhiroop joined
06:15 kritzcreek joined
06:19 govg joined
06:19 takle joined
06:19 <trudyjane> Good morning, Have a question about the traversable instance for the Constant type.
06:23 hphuoc25 joined
06:23 <trudyjane> In traverse _ (Constant x) = pure (Constant x), it seems it would just return a Constant. How does traverse know to embed a Constant in the 'f' passed to it?
06:25 hphuoc25 joined
06:25 <jle`> trudyjane: hm, what do you mean?
06:26 <jle`> trudyjane: what 'f' do you mean?
06:26 <jle`> the Applicative, or the function?
06:26 <trudyjane> pure embeds the Constant a in a structure, but Constant's applicative instance just returns a Constant.
06:26 <jle`> we aren't using Constant's Applicative instance
06:27 <trudyjane> Oh, so the pure that is being called is based on the 'f' passed in?
06:27 <jle`> it's based on the type
06:27 <jle`> traverse :: Applicative f => (a -> f b) -> Constant c a -> f (Constant c b)
06:27 <jle`> it's the f there
06:28 <jle`> the f in the type signature
06:28 <trudyjane> I see now it makes sense, thank you. Was turned around by looking at Constant's applicative pure definition.
06:28 <jle`> no problem!
06:29 <trudyjane> Helps to look at type signatures too : )
06:29 <jle`> it's indirectly potentially related to the function passed in, because the type of the function passed in may help Haskell with type inference for what the 'f' type variable is instantiated to
06:29 newhoggy joined
06:30 <jle`> but haskell might also be able to infer what 'f' is from the context in which the result is used, as well
06:30 <trudyjane> That's what I was wondering about.
06:30 <jle`> > traverse pure (Const 10) :: Maybe (Const 10)
06:30 <lambdabot> error:
06:30 <lambdabot> • Expecting one more argument to ‘Const 10’
06:30 <lambdabot> Expected a type, but ‘Const 10’ has kind ‘k0 -> *’
06:30 <jle`> aw
06:30 <jle`> > traverse pure (Const 10) :: Maybe (Const Int Double)
06:30 <lambdabot> Just (Const 10)
06:30 <jle`> there it knows that 'f' is Maybe because of the return type to expect
06:30 <jle`> > traverse Just (Const 10)
06:30 <lambdabot> Just (Const 10)
06:31 <jle`> there it knows that 'f' is Maybe because of the type of the function given to it
06:31 <jle`> type inference is fun :)
06:31 <trudyjane> Yes!
06:31 <jle`> probably should have used a better function
06:31 <jle`> > traverse (\_ -> Nothing) (Const 10)
06:31 <lambdabot> Just (Const 10)
06:31 <trudyjane> That's nice, I was using (\x -> Just x)
06:32 <jle`> yeah, but that example is a little misleading because it makes it look like traverse = ($), heh
06:32 <trudyjane> Ha!
06:32 takle joined
06:34 <eatman> Hi! I'm trying to use Data.Graph but I'm havin issues when it comes to use a graph as a Functor instance.
06:34 <eatman> My Graph represent a Game Of Life board.
06:35 <eatman> (Every cell connected to its neighbors.)
06:35 dni- joined
06:35 <eatman> Is there any *easy* way to map over the cells without having to make many functions call to retrieve neigbhors?
06:36 <eatman> I thought the cells (state, key, neighbors) would have benn accessible.
06:36 abhiroop joined
06:36 <jle`> eatman: what package are you using?
06:36 <eatman> where neighbors == [key].
06:36 <eatman> Data.Graph.
06:36 <jle`> fgl?
06:37 <jle`> that's a module
06:37 <jle`> but what package provides it?
06:37 <eatman> Well, I've no idea.
06:37 <jle`> what library?
06:37 <jle`> because it's not a part of the base library
06:37 <eatman> I added http://ix.io/rkl
06:38 <eatman> And then *import Data.Graph*.
06:38 <jle`> ah it's probably from 'containers' then
06:38 <jle`> since your library depends on 'containers'
06:38 <jle`> and 'containers' does export a module called Data.Graph
06:38 <eatman> Yep, you're right.
06:38 <jle`> what is your graph type?
06:38 <eatman> Have I done it the wrong way?
06:38 <jle`> is it 'Graph' ?
06:39 <eatman> http://ix.io/rkn/hs
06:39 <eatman> Yep.
06:39 <jle`> i've never used container's graphs myself; the typical graph library people use is the graphs from fgl, but i'm sure it's fine for simple use cases
06:40 <eatman> I didn't know there would be more than one Data.Graph.
06:40 <eatman> (Noob)
06:40 <jle`> well, there's only one Data.Graph that i know of
06:40 <eatman> Anyway, I'm using the graphFromEdges :: Ord key => [(node, key, [key])] -> (Graph, Vertex -> (node, key, [key]), key -> Maybe Vertex)
06:41 <eatman> Source
06:41 <jle`> but there are multiple packages that implement graphs
06:41 <jle`> but, graphs in haskell really aren't all that common either
06:41 <eatman> Well, I couldn't think of something better to represent a rectangular board game.
06:42 <jle`> are you talking about conway's game of life
06:42 <jle`> or like, the board game
06:42 <eatman> Yep.
06:42 <jle`> oh
06:42 <jle`> it's probably better to just use a 2d array
06:42 <jle`> or even a vector of vectors
06:42 <eatman> Well... sounds easer but not FP-friendly.
06:42 <jle`> how do figure?
06:43 <eatman> ?
06:43 <jle`> why do you think so?
06:43 <jle`> sorry, i meant to say how do you figure, heh
06:44 <eatman> Because I come from C++ and 2D Arrays of vectors of vectors sounds pretty much like nested loops to me.
06:44 <jle`> hm
06:44 <jle`> nested loops is control flow
06:44 <jle`> vectors and arrays are just data
06:44 <jle`> it's very haskell :)
06:44 <jle`> pure vectors and pure arrays
06:44 <jle`> a nested vector type might be Vector (Vector Double)
06:45 <jle`> er sorry, Vector (Vector Bool)
06:45 <jle`> and you can fmap over it
06:45 <jle`> (fmap . fmap) :: (a -> b) -> Vector (Vector a) -> Vector (Vector b)
06:45 <jle`> etc.
06:45 <jle`> you can even generate vectors purely using the generate function
06:45 newhoggy joined
06:45 <jle`> generate :: Int -> (Int -> a) -> Vector a
06:46 <jle`> give a size, and a function from index to value, and you get a vector! :)
06:46 <jle`> generate 10 (\x -> x**2) gives you a vector of squares from 0 to 81
06:46 <jle`> super functional :)
06:46 <jle`> no nested loops anywhere
06:46 <eatman> But, I need to access each neighbors.
06:47 <jle`> yes, which is why vectors support indexing
06:47 <eatman> Yeah, this is the ugly part to me.
06:47 <jle`> indexing?
06:47 <jle`> indexing is what vectors are best at :)
06:47 <eatman> Given an index, generate the neighbors indexes.
06:47 <jle`> sounds like a pure function to me
06:48 <eatman> You're probably right :-)
06:48 <jle`> in fact this is probably much uglier in an imperative language
06:48 <jle`> which might be why you are averse to it
06:48 <eatman> Have to go for a coffe with coworkers, will be back in 15.
06:48 <eatman> Thanks a lt for the advices
06:48 <jle`> have a nice coffee! and no problem
06:53 takle joined
07:00 hvr joined
07:00 hvr joined
07:01 <eatman> Back.
07:01 abhiroop joined
07:02 <eatman> So, in order to avoid the same "error" as with Graphs.
07:02 <eatman> Wich Vector am I suppoed to use?
07:04 dni- joined
07:05 Pupnik joined
07:06 dmi3y joined
07:06 newhoggy joined
07:07 mengu joined
07:08 <jle`> you can either use nested vectors or 2d arrays
07:08 <jle`> or you can use a flat array and do some math to manage the indexing
07:09 <jle`> one simple way would be to make your update function a Vector (Vector Bool) -> Vector (Vector Bool)
07:10 <jle`> updateGame v = generate 10 (\x -> generate 10 (\y -> ...use logic to generate the tile at (x,y).....))
07:11 <jle`> for example, if you wanted to just have the new board be identical to the previous board
07:11 <jle`> updateGame v = generate 100 $ \x ->
07:11 <jle`> generate 100 $ \y ->
07:12 <jle`> (v ! x) ! y)
07:12 <jle`> er the last parentheses should be there, but yeah
07:12 <jle`> assuming your boards are 100 x 100
07:12 newhoggy joined
07:12 <jle`> that's just one simple way to do it :)
07:17 takle joined
07:18 abhiroop joined
07:22 vaibhavsagar_ joined
07:29 xmonader2 joined
07:30 takle joined
07:33 grayjoc joined
07:45 galderz joined
07:49 thc202 joined
07:50 dni- joined
07:54 GreySunshine joined
07:55 takle joined
07:55 abhiroop joined
08:02 takle joined
08:05 yellowj joined
08:07 Cir0X joined
08:08 grdryn joined
08:10 dennisvennink joined
08:14 colt44 joined
08:15 zero_byte joined
08:16 abhiroop joined
08:17 tusj joined
08:18 chbatey joined
08:18 abhiroop joined
08:18 tusj joined
08:21 merijn joined
08:23 mattyw joined
08:23 takle joined
08:27 abhiroop joined
08:28 meandi joined
08:30 bvad joined
08:31 merijn joined
08:31 dmi3y joined
08:35 abhiroop joined
08:35 tusj joined
08:37 govg joined
08:38 takle joined
08:42 binaryplease joined
08:45 mattyw joined
08:50 nickolay joined
08:51 nacon joined
08:51 nacon joined
08:52 ski joined
08:56 hphuoc25 joined
08:57 tusj joined
08:57 Iceland_jack joined
09:00 mthek joined
09:00 dennisvennink joined
09:01 chbatey joined
09:02 takle joined
09:06 takle joined
09:08 binaryplease joined
09:15 tusj joined
09:20 fbergmann joined
09:34 uglyfigurine joined
09:37 tusj joined
09:41 abhiroop joined
09:48 govg joined
09:48 Glooomy joined
09:49 slomo joined
09:55 m1dnight_ joined
09:58 g0d355__ joined
10:23 <Akii> IO is scary af
10:23 <Akii> really having problems sticking my app together now
10:23 <Akii> because eveything can go to hell everywhere
10:30 abhiroop joined
10:31 slomo joined
10:35 hphuoc25 joined
10:38 Glooomy joined
10:45 hphuoc25 joined
10:46 Iceland_jack joined
10:50 hphuoc25 joined
10:51 xunien joined
10:52 Durbley joined
11:00 binaryplease joined
11:02 Mak_ joined
11:07 Glooomy joined
11:10 dmi3y joined
11:23 mengu joined
11:31 newhoggy joined
11:36 abhiroop joined
11:39 <Akii> how does one manage dependencies on a larger scale?
11:39 <merijn> Akii: What do you mean?
11:40 <Akii> well I've a somewhat bigger application now with little data types flying around everywhere that express the dependency of a sub component
11:40 <Akii> it's all a mess, really
11:41 <merijn> Akii: What kinda dependencies are you expressing?
11:41 <merijn> (brb, meeting)
11:42 <Akii> anyone got an example of a larger Haskell application?
11:43 netheranthem joined
11:43 abhiroop joined
11:46 NoCreativity joined
11:51 Gloomy joined
11:51 <yushyin> ghc
11:51 <tuturto> akii: https://github.com/LambdaHack/LambdaHack
12:05 <merijn> Akii: GHC, Pandoc, Xmonad? :)
12:06 <Akii> ye that's not what I need right now
12:06 <Akii> nvm
12:06 <Akii> looking at the recently released wire server was benefitial
12:06 <Akii> but that's just small stuff
12:26 harfangk joined
12:30 chbatey joined
12:32 grayjoc joined
12:33 acarrico joined
12:51 exferenceBot joined
12:51 pbrant joined
13:01 hphuoc25 joined
13:02 hphuoc25 joined
13:05 <evilmaid> i think rumuki was written in haskell aswel, hold on
13:06 <evilmaid> https://github.com/rumuki/rumuki-server not sure if it qualifies as large though
13:12 mizu_no_oto_work joined
13:14 Gloomy joined
13:18 <Akii> evilmaid: thanks, will check it out
13:18 GreySunshine joined
13:19 <Akii> random question: anyone in here working for codecentric?
13:20 hphuoc25 joined
13:24 hphuoc25 joined
13:29 <Akii> evilmaid: bit small indeed
13:30 <Akii> I think the issue I'm having is purely with composition
13:30 developernotes joined
13:30 <Akii> and that's one of the things where coming up with right questions is so hard
13:44 chlong joined
13:45 jathan joined
13:46 GreySunshine_ joined
13:49 <ThomasLocke> Anybody got some good links on acid-state and some good patterns for usage? I'm dabbling and having some difficulties figuring out how to design my types.
13:49 GreySunshine_ joined
13:54 <merijn> ThomasLocke: Well, what are you trying to store in it?
13:55 dennisvennink joined
13:56 moei joined
13:56 moei joined
13:56 <ThomasLocke> merijn, Lists of things really. Imagine People, Deps, Orgs and Docs.
13:57 <merijn> What's the difficulty?
13:57 <ThomasLocke> Many many many Docs, fewer People, even fewer Deps and perhaps a few hundred Orgs.
13:57 <ThomasLocke> Should I just dump all of it in the same acid-state db or one for each type?
13:58 <merijn> I generally recommend people to not consider acid-state a database at all
13:58 <ThomasLocke> I understand. I'm just trying to learn and experiment.
13:58 <ThomasLocke> I have done it with SQLite, now I'm looking to learn something different. :)
13:59 <* ThomasLocke> is very bad at Haskell
13:59 <merijn> acid-state isn't very well suited to the relational model of "storing bunches of lists"
14:01 <ThomasLocke> merijn, What is it good for then? I'd like to learn, so what kind of types should I mock to learn to use it?
14:01 <merijn> ThomasLocke: It's good for situations where you have some Haskell datatype for which you want ACID guarantees, like the state of a daemon or something
14:03 mthek joined
14:03 <ThomasLocke> So if a have a map type, and I'd like to have ACID and disk-backing, then it could also fit?
14:04 <ThomasLocke> Basically a simple key-value store with a few extra bells and whistles?
14:06 Rodya_ joined
14:06 <Akii> ThomasLocke: was it you who was working on this kind of queue thing?
14:06 <ThomasLocke> Akii, Ah yes, my queue experiement!
14:06 <ThomasLocke> Akii, That was fun, albeit completely useless. :D
14:07 <Akii> haha
14:07 <Akii> :D
14:07 GreySunshine_ joined
14:07 <ThomasLocke> But it worked, and that was a proud moment for me: I'd made something in Haskell, and it did what I wanted. WOoooooo
14:07 <eatman> jle`: Thanks for the 2D Array advice, it works like a charm.
14:09 carlomagno1 joined
14:09 <ThomasLocke> Akii, You can see the entire thing in all its "glory" here: http://hub.darcs.net/ThomasLocke/haskell-playground/browse/jobQueue
14:09 <eatman> Hey, I now have a **splendid** working state monad playing the Conway's game of life.
14:09 <ThomasLocke> eatman, Congrats!
14:10 <eatman> How can I make it run "forever" and pick the results one after the other?
14:10 <eatman> ThomasLocke: Thanks.
14:10 GreySunshine_ joined
14:11 <eatman> ThomasLocke: pretty much like you said : "I've a useless working piece of code that make me feel **Wooooooo**"
14:11 <ThomasLocke> eatman, It's a damn good feeling!
14:11 <ThomasLocke> It might be the most sucky Haskell ever written, but it is mine dammit! :D
14:16 <Akii> ThomasLocke: nice :D
14:17 <ThomasLocke> I'm fairly happy with it. Not too much dark magic going on.
14:20 slomo joined
14:23 takle joined
14:30 <eatman> Am I wrong when thinking about the State monad when I want to run my "game of life" indefinitely and get an infinite list of the states as a result?
14:32 dmi3y joined
14:33 <ski> @type iterate
14:33 <lambdabot> (a -> a) -> a -> [a]
14:36 rmbd joined
14:36 rmbd left
14:36 <eatman> Ahah, no need for this State thing...
14:37 <eatman> As usual it's easier than it looks.
14:37 <Akii> I'm not getting it
14:37 <Akii> :D
14:38 <eatman> To conclude my Haskell week : I still can't find any use for the Reader/State monads.
14:39 <glguy> you never "need" either of those types, they can just be useful if you're reimplementing what they do inline
14:39 <Akii> eatman: I use the State Monad to add the effect of emitting domain events to my functions
14:41 <glguy> they're most useful in isolated bits or when implementing some other opaque type
14:41 <eatman> That, can also be what limitates my understanding of the whole thing : I've no idea what "add the effect of emitting domain events".
14:42 <eatman> *means.
14:45 <Akii> gimmeh a sec, writing an example
14:45 <Akii> but it'll be a boring business example
14:52 newhoggy joined
14:54 chlong_ joined
14:56 kyleschmidt joined
15:03 <Akii> eatman: http://lpaste.net/354801
15:03 <Akii> boring basket events hype
15:03 <ski> eatman : a toy example. given `data Tree a = Tip | Node a (Tree a) (Tree a)', write `label :: Tree a -> Tree (Integer,a)' which labels the elements in a pre-order traversal, counting up from `0'
15:04 <ski> then, if you want to, write `normalize :: Fractional a => Tree a -> Tree a' which subtracts the mean of the elements, from each element, with a single tree traversal
15:09 dni- joined
15:11 binaryplease joined
15:12 Gurkenglas_ joined
15:19 dni- joined
15:19 uglyfigurine joined
15:25 MotherFlojo joined
15:27 <eatman> Akii, ski: thanks.
15:27 ralu joined
15:29 newhoggy joined
15:34 newhoggy joined
15:35 hphuoc25 joined
15:36 ralu joined
15:37 ralu joined
15:38 <eatman> ski: Ok, got it, not useless, only that I wasn't using it purposely.
15:38 eacameron joined
15:41 yellowj joined
15:41 skeet70 joined
15:41 newhoggy joined
15:44 dennisvennink joined
15:52 newhoggy joined
15:52 baweaver left
16:00 newhoggy joined
16:01 abhiroop joined
16:02 binaryplease joined
16:09 newhoggy joined
16:11 meandi_2 joined
16:12 blissdev joined
16:16 nicknovitski joined
16:16 newhoggy joined
16:20 abhiroop joined
16:23 delexi joined
16:24 conal joined
16:24 newhoggy joined
16:30 pungi-man joined
16:35 abhiroop joined
16:35 newhoggy joined
16:36 mac10688 joined
16:43 <saylu> Hey folks!
16:43 <saylu> I’m processing some data and wonder if you can recommend the correct way to structure it.
16:43 <saylu> I’m combining several CSVs together, with a ton of data about a specific URL that stays constant. So one URL will be associated with 20 “columns” of data.
16:44 <saylu> I’ll then be aggregating data and making calculations from it and so on. For example, one column is “Category”, and many URLs can share the same category. So I might want to find the average of a column for that category.
16:44 <saylu> Does a record type seem the right fit, or Data.Map?
16:44 <Akii> Map URL [Column]
16:44 <Akii> could work
16:44 madjestic joined
16:48 <Akii> well map reduce err foldl the thing
16:50 <saylu> Foldl+
16:50 <saylu> *foldl?
16:50 <Akii> :t foldl
16:50 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
16:50 <saylu> Oh, sorry, just mean -- what for?
16:50 newhoggy joined
16:50 <saylu> Oh, for aggregations?
16:50 <Akii> yup
16:50 <saylu> Right. Yea, that makes sense to do it that way.
16:50 <Akii> well, that's so generic
16:51 <Akii> have you looked at pipes?
16:51 <Akii> like the library
16:51 <saylu> I haven't, no
16:52 <Akii> that's basically stream processing
16:52 <saylu> Checking it now
16:52 <Akii> depending on your level of Haskell which is unknown to me that might be a bit much
16:54 <saylu> I'm getting there, slowly but surely :) Finished most of the haskell book, with exercises, up to the monad transformers chapter I'm in now
16:54 <saylu> So this would be in order to stream data around rather than load big chunks of it into memory then process it?
16:55 <saylu> Fortunately these csvs won't have more than 100,000 rows at any point
16:55 <Akii> well ye, pipes are probably overkill
16:55 newhoggy joined
16:55 <Akii> I was thinking you could define pipes that transform your data
16:55 <Akii> but well, might as well just use functions
16:56 <Akii> with 100k rows you can easily map over them many times
16:57 peterbecich joined
16:57 chrissl joined
17:01 abhiroop joined
17:02 <saylu> I think I'll start without pipes, but it looks interesting, and would make useful practice to extend with them.
17:02 <saylu> is pipes the same concept as conduit?
17:02 <MarcelineVQ> conduits, the other main lib that does what pipes does, also has some stuff for csv
17:02 <MarcelineVQ> I've only just glanced at it though so I couldn't say what's a good route
17:04 dennisvennink joined
17:06 <saylu> Oh, very interesting
17:06 <saylu> https://github.com/ozataman/csv-conduit
17:07 newhoggy joined
17:07 <saylu> I think mine are a bit too small for this use case, but a bit later in the year I'll be working on a few csvs with a few million rows and this will be helpful -- especially over HTTP
17:07 <saylu> thanks for the notes Akii MarcelineVQ
17:08 <MarcelineVQ> I tried using that but it turned out I don't know how to use conduit hehe, I'll let you know if it works well when I get back to it
17:17 newhoggy joined
17:19 bvad joined
17:19 meandi joined
17:24 <saylu> In record types, is camelCase or under_score "accepted style"?
17:28 <ski> i think `camelCase' is the more common naming convention for field names
17:29 abhiroop joined
17:29 <saylu> What about with pre-pending?
17:29 <saylu> say I have pageTitle, wordCount
17:29 <saylu> but I want to prefix it
17:29 <saylu> so, say sf_pageTitle, sf_wordCount
17:29 <saylu> would this still be a time to use camel case?
17:30 <saylu> sfPageTitle, sfWordCount
17:30 <ski> i'd probably capitalize the previous first letter like that, yes
17:30 <ski> not sure how common it'd be
17:31 kadoban joined
17:31 <saylu> Sure thing!
17:32 abhiroop joined
17:32 <geekosaur> there's a quasi-convention that underscores represent a marshaling type and camel case a Haskell type, when they differ
17:32 ralu joined
17:38 <saylu> Oof
17:39 Iceland_jack joined
17:39 <saylu> Anyone know how to skip a line in Cassava, to use the _second_ line as the header?
17:40 <Akii> saylu: don't know but maybe you can skip the line before giving it to Cassava
17:41 <Akii> if that helps
17:42 <saylu> Hmm
17:43 <saylu> I suppose I read it in as a ByteString, so if I can throw away the first "row" of the bytestring then I'd be good to go
17:43 <saylu> But since Cassava is already there to parse the CSV, seems it would be more convenient to use that directly
17:43 dennisvennink joined
17:45 <saylu> unfortunately the first row of my CSV is wasted on the text "internal_html" in the first column and nothing else
17:45 newhoggy joined
17:46 Iceland_jack joined
17:46 <Akii> why tho
17:46 <Akii> I'd just throw that line away
17:46 <saylu> Ha! Just what the tool that generates these outputs
17:47 <saylu> *adds
17:47 <Akii> that's just the same with the JSON the other day
17:47 <Akii> where you have some strange "__embedded" things
17:52 <evilmaid> sounds absurd =^.^=
17:52 <Akii> nobody would ever do that
17:53 newhoggy joined
17:53 USBoss joined
17:54 hphuoc25 joined
17:55 hphuoc25 joined
17:56 <USBoss> When I run stack setup, GHC fails to compile a sanity check because the sanity check file is not present in my temp folder (Windows 10). Can anyone tell me why it would not be there?
17:56 govg joined
17:58 <USBoss> \join #haskell
17:59 <Akii> it's `/join #haskell`
17:59 <evilmaid> or turn that \ upside down
17:59 <Akii> flip \
18:01 newhoggy joined
18:01 <USBoss> always forget which slash it is
18:08 <ski> \ɾoı̣u #ɥɐsʞǝןן
18:08 newhoggy joined
18:09 <Akii> `:t (/join) :: IO ()` tho
18:09 <xunien> aha seriously
18:12 dmi3y joined
18:12 Uniaika joined
18:12 hphuoc25 joined
18:21 ysgard joined
18:24 newhoggy joined
18:25 thc202 joined
18:30 alephgorm joined
18:33 newhoggy joined
18:33 mac10688 joined
18:35 ubsan joined
18:36 hphuoc25 joined
18:40 newhoggy joined
18:48 newhoggy joined
18:50 Rodya_ joined
18:53 Kuros joined
18:53 jud joined
18:55 abhiroop joined
18:57 uglyfigurine joined
18:57 AndreasK joined
18:59 newhoggy joined
19:01 abhiroop joined
19:02 mizu_no_oto_work joined
19:15 newhoggy joined
19:18 aarvar joined
19:21 niez joined
19:23 newhoggy joined
19:24 merijn joined
19:28 madjestic joined
19:31 <evilmaid> nice little anecdote "thinking in types" https://robots.thoughtbot.com/thinking-in-types nice example of embracing haskells type system to work around heterogenous lists
19:33 alephgorm joined
19:35 albertus1 joined
19:35 newhoggy joined
19:36 USBoss left
19:37 ysgard left
19:41 holygun joined
19:47 conal joined
19:48 newhoggy joined
19:49 <abhiroop> I want to use the `modify` function of State monad inside a let binding which resides inside a do notation. Something like this: http://lpaste.net/354812
19:49 <abhiroop> How do i go about it
19:51 <geekosaur> what the paste shows looks reasonable; do you have an actual failing case, and if so how does it fail?
19:53 Rodya_ joined
20:00 Gurkenglas joined
20:01 newhoggy joined
20:03 <abhiroop> geekosaur: What I actually have is this: http://lpaste.net/354813
20:04 <abhiroop> I cant write modify inside the let clause
20:04 <abhiroop> nor in the in clause
20:04 <geekosaur> yes, becuase let doesn;t work that way, you want to write the modify in the bindings
20:04 <geekosaur> which makes no sense
20:05 vmeson joined
20:05 <geekosaur> s/you want to/you are trying to/
20:06 <geekosaur> possibly you intended a do in there, but I can't quite tell from that little information
20:07 <geekosaur> alternately you wanted let ... in do ...
20:07 <geekosaur> but then you can just write the let in the do-specific format without the in
20:08 <abhiroop> Yeah I wanted to do something like let .. in do
20:08 Deide joined
20:11 grayjoc joined
20:11 vmeson joined
20:12 newhoggy joined
20:12 Rodya_ joined
20:17 uglyfigurine joined
20:17 texasmynsted joined
20:21 newhoggy joined
20:21 Gloomy joined
20:27 wildlander joined
20:29 newhoggy joined
20:30 meandi joined
20:32 MotherFlojo joined
20:32 AndiK joined
20:37 ysgard joined
20:38 newhoggy joined
20:47 newhoggy joined
20:50 takle_ joined
20:51 slomo joined
20:53 GreySunshine joined
20:54 takle joined
20:56 newhoggy joined
21:01 netheranthem joined
21:06 newhoggy joined
21:12 lukky513 joined
21:12 alephgorm joined
21:13 lukky513_ joined
21:14 newhoggy joined
21:15 thc202 joined
21:17 <saylu> Hmm -- I need to consolidate several csvs keyed by the first column, URL. If I'm going to be doing a ton of lookups (they aren't in the same order) does it make sense to use a map of 12-tuples rather than a list of record types (with 12 fields)?
21:19 <saylu> Parse each csv into a map of tuples keyed by URL or into a list of record types with a "URL" field, and then combine into a final map of tuples or record type with the consolidated data
21:19 <saylu> Kind of like doing lookups in Excel from multiple sheets
21:20 machinedgod joined
21:21 <monochrom> Yes, I would use a dictionary, Data.Map or Data.Hashmap.
21:22 <monochrom> In fact, I did.
21:22 Cale joined
21:23 malaclyps joined
21:24 newhoggy joined
21:25 <saylu> Oh -- well, I suppose a map of records would work fine
21:26 peterbecich joined
21:29 newhoggy joined
21:30 alephgorm joined
21:33 GreySunshine joined
21:33 abhiroop joined
21:34 newhoggy joined
21:42 newhoggy joined
21:43 aueuaio joined
21:44 netheranthem joined
21:45 nicknovitski joined
21:46 abhiroop joined
21:47 colt44 joined
21:48 newhoggy joined
21:50 peterbecich joined
21:53 hiratara joined
21:57 newhoggy joined
21:57 aueuaio left
22:01 newhoggy joined
22:05 abhiroop joined
22:10 newhoggy joined
22:13 justicefries joined
22:13 thang1 joined
22:15 texasmynsted joined
22:20 Gloomy joined
22:23 newhoggy joined
22:27 texasmynsted joined
22:28 xificurC joined
22:31 hiratara joined
22:32 MotherFlojo joined
22:33 pilne joined
22:35 newhoggy joined
22:37 sigmundv__ joined
22:44 myrkraverk joined
22:46 prophile joined
22:46 newhoggy joined
22:54 newhoggy joined
22:59 newhoggy joined
23:02 ysgard_ joined
23:07 newhoggy joined
23:12 <reptar_> how would i go about splitting a list at a specific element?
23:14 <reptar_> like ["frog", "frog", "fish", "frog", "fish", "frog", "frog", "frog", "frog"] -> [["frog", "frog"], ["frog"],, ["frog", "frog", "frog", "frog"]]
23:15 newhoggy joined
23:23 newhoggy joined
23:27 <thang1> Haskell doesn't have a built in solution for this. Look up "take" and "drop"
23:28 <thang1> nvm thought you wanted a list slice. You want something different
23:29 <thang1> reptar_: check out Data.List.Split. It has functions splitOn, splitOneOf, splitWhen, and so on
23:30 <reptar_> thang1: will do, thanks!
23:31 abhiroop joined
23:31 newhoggy joined
23:32 <thang1> In particular, splitAt "fish" [list....] should do what you want
23:33 <thang1> (btw: I got this by googling "split list on predicate in haskell")
23:33 <thang1> > splitOn "fish" ["frog","frog","fish","frog","fish","frog","frog","frog","frog"]
23:33 <lambdabot> error:
23:33 <lambdabot> • Couldn't match expected type ‘Char’ with actual type ‘[Char]’
23:33 <lambdabot> • In the expression: "frog"
23:33 Durbley joined
23:37 <thang1> Ahh whoops, strings are lists of char so it's a list of lists. It'll choke on that a little
23:38 newhoggy joined
23:40 <thang1> >split (startsWith "fish") ["frog","frog","fish","frog","fish","frog","frog","frog","frog"] -- This shouldn't work either
23:40 <thang1> > split (startsWith "fish") ["frog","frog","fish","frog","fish","frog","frog","frog","frog"] -- This shouldn't work either... even when typed correctly
23:40 <reptar_> thang1: it's ok, i can use getContents, then splitOn, then split the frogs
23:40 <lambdabot> error:
23:40 <lambdabot> • Couldn't match expected type ‘Char’ with actual type ‘[Char]’
23:40 <lambdabot> • In the expression: "frog"
23:41 <thang1> no problem, glad I could help. The split library has combinators so that it's possible to create some fancier stuff if you get so inclined
23:45 newhoggy joined
23:54 newhoggy joined