<    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:01 leothrix joined
00:11 tromp joined
00:12 FjordPrefect joined
00:18 <Jello_Raptor> huh, is there a standard way to "MonadState s m => Lens s a -> (a -> (b,a)) -> m b" I mean it's just "overAnd l f = state $ l f" but I'm curious why there's no operator for it in Control.Lens since it's something that I keep on needing (I'm using `<&=` for the moment)
00:18 plutoniix joined
00:19 <Jello_Raptor> or is there a good reason to not define that operator?
00:19 <c_wraith> it seems a little specialized.
00:20 robertkennedy joined
00:22 <Jello_Raptor> fair enough
00:23 Welkin joined
00:25 oisdk joined
00:27 <jle`> Jello_Raptor: is %%= what you are looking for?
00:28 <jle`> (%%=) :: MonadState s m => Lens s s a b -> (a -> (r, b)) -> m r
00:32 mkoenig joined
00:38 andyhuzhill joined
00:39 vaibhavsagar joined
00:40 louispan joined
00:40 m_ryan joined
00:41 <m_ryan> hi i have a question here: how do i insert a character in every char on strin?
00:41 lol__ joined
00:41 <m_ryan> e.g HELLO -> %H%E%L%L%L%O%
00:41 Nicmavr joined
00:43 <peddie> :t intersperse
00:43 <lambdabot> a -> [a] -> [a]
00:43 <Welkin> yes
00:43 <peddie> > intersperse '%' "HELLO"
00:43 <lambdabot> "H%E%L%L%O"
00:43 <peddie> m_ryan: ^
00:43 <Welkin> you could write all of these functions yourself m_ryan
00:43 <Welkin> or just search hoogle for `a -> [a] -> [a]`
00:44 <Koterpillar> @hoogle a -> [a] -> [a]
00:44 <lambdabot> Data.List intersperse :: a -> [a] -> [a]
00:44 <lambdabot> GHC.OldList intersperse :: a -> [a] -> [a]
00:44 <lambdabot> Data.Text.Internal.Functions intersperse :: a -> [a] -> [a]
00:44 <m_ryan> thanks everyone :)
00:46 insertname joined
00:49 <Welkin> > (init . concat . zipWith (\a b -> [a, b])) "hello" (repeat '%')
00:49 <lambdabot> error:
00:49 <lambdabot> • Couldn't match expected type ‘[Char] -> t’
00:49 <lambdabot> with actual type ‘[[Char]]’
00:49 ExpHP_ joined
00:49 <Welkin> :t repeat
00:49 <lambdabot> a -> [a]
00:49 <Welkin> > repeat '%'
00:49 <lambdabot> "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
00:49 <Koterpillar> Welkin: did you want concatMap there somewhere?
00:51 norotartagen joined
00:51 {emptyset} joined
00:51 <Koterpillar> > concatMap (:"%") "hello" -- almost
00:51 <lambdabot> "h%e%l%l%o%"
00:51 <Welkin> > init . concat $ zipWith (\a b -> [a, b]) "hello" (repeat '%')
00:51 <lambdabot> "h%e%l%l%o"
00:52 <Welkin> lol, sure, that works too
00:52 <Welkin> one thing I love about haskell is that there is more than one way to do it
00:52 <Sonolin> you must love perl too, right?
00:52 <Welkin> haha
00:52 <Welkin> nope
00:52 norotartagen joined
00:52 Rodya_ joined
00:52 <Welkin> it's an entertaining language though
00:52 <Sonolin> yea just joshing you ;)
00:52 ebzzry joined
00:52 <Koterpillar> Welkin: notice that all these solutions are doing different things
00:53 <robertkennedy> When Wadler talks about `fix :: (a -> a) -> a`, how separate is this function from `fix' :: (a->a)-> a -> a`, which takes a seed value? Newton's algorithm seems a member of fix' but not fix
00:53 <Welkin> Koterpillar: yes, but the result is the same
00:53 <Koterpillar> Welkin: no
00:53 <Welkin> Koterpillar: add an `init` to yours and it is
00:53 <Koterpillar> Welkin: notice the first and last '%' absent
00:54 nighty- joined
00:54 <Koterpillar> ah, you're right, I thought the first one did "%h%e%l%l%o%"
00:55 arctictern joined
00:55 <Welkin> concatMap is also just concat . map
00:55 darjeeling_ joined
00:55 <Welkin> and map (:"%") is the same as zipWith (\a b -> [a, b]) <string> (repeat '%')
00:56 <m_ryan> how do i run some code here?
00:56 <Koterpillar> so are you saying there's just one way to do it, just written differently?
00:56 <Welkin> m_ryan: prefix with >
00:56 <Welkin> Koterpillar: lol, maybe
00:56 soLucien joined
00:57 <tobiasBora> geekosaur: Thank you for your VIRT explaination!
00:57 <Koterpillar> m_ryan: prefix it with "> ". You can also message lambdabot with that
00:57 <m_ryan> > init . concat $ zipWith (\a b -> [a, b]) "%hello%" (repeat '%')
00:57 <lambdabot> "%%h%e%l%l%o%%"
00:57 <m_ryan> > init . concat $ zipWith (\a b -> [a, b]) "hello" (repeat '%')
00:57 <lambdabot> "h%e%l%l%o"
00:57 nighty- joined
00:58 <m_ryan> what is the best way to append % from start and end of the text?
00:58 <Welkin> m_ryan: intersperse
00:58 mac10688 joined
00:58 <Welkin> it's already defined
00:58 <Koterpillar> m_ryan: just start and end, or in between too?
00:58 <Welkin> we were just having fun writing our own implementation
00:58 <m_ryan> > intersperse "%" "hello"
00:58 <lambdabot> error:
00:58 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
00:58 <lambdabot> Expected type: [[Char]]
00:59 <Welkin> it takes a Char not a String
00:59 <m_ryan> > intersperse '%' 'hello'
00:59 <lambdabot> error:
00:59 <lambdabot> • Syntax error on 'hello'
00:59 <lambdabot> Perhaps you intended to use TemplateHaskell or TemplateHaskellQuotes
00:59 <Welkin> > intersperse '%' "Dr Pete Loomis"
00:59 <lambdabot> "D%r% %P%e%t%e% %L%o%o%m%i%s"
00:59 <Welkin> m_ryan: '' is for Char, "" is for String
00:59 <Welkin> I thought you knew this o.o
00:59 <m_ryan> intersperse '%' "HELLO"
01:00 <m_ryan> > intersperse '%' "HELLO"
01:00 <lambdabot> "H%E%L%L%O"
01:00 eazar001 joined
01:00 <isd> Hey all. I'm getting my hands dirty with the ST monad & mutable vectors for the first time, and I'm banging my head against a type error. Here's a simplified version of the code: http://lpaste.net/3328211105888600064
01:00 Laney joined
01:00 <m_ryan> Welkin: not very familiar :)
01:00 <Welkin> > intercalate "NaNaNaNaNaNaNaNa" "BATMAN"
01:00 <lambdabot> error:
01:00 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
01:00 <lambdabot> Expected type: [[Char]]
01:00 <isd> and the error: http://lpaste.net/1872846555577319424
01:01 <Welkin> > intercalate "NaNaNaNaNaNaNaNa" (replicate 5 "BATMAN")
01:01 <lambdabot> "BATMANNaNaNaNaNaNaNaNaBATMANNaNaNaNaNaNaNaNaBATMANNaNaNaNaNaNaNaNaBATMANNaN...
01:01 <Koterpillar> m_ryan: just start and end, or in between too?
01:01 <m_ryan> both
01:02 <Welkin> just start and end is easy
01:02 <Welkin> just flip the parameters
01:02 <Welkin> and use intercalate
01:02 <m_ryan> flip?
01:02 <Welkin> > intercalate "Batman" (replicate 2 "%")
01:02 <lambdabot> "%Batman%"
01:03 <Welkin> lol, yes you can use flip too
01:03 <isd> I feel like I half get what it's talking about, but am at enough of a loss that I'm having trouble articulating what I do understand. The vector package uses a handful of language extensions I haven't played with before.
01:03 <isd> Um. any insights?
01:03 <Welkin> > (flip intercalate) (replicate 2 "%") "Batman"
01:03 <lambdabot> "%Batman%"
01:03 norotartagen joined
01:03 markasoftware joined
01:03 <m_ryan> > (flip intercalate) (replicate 2 "%") (interperse '%' "Batman")
01:03 <Welkin> isd: ask away and someone might answer
01:03 <lambdabot> error:
01:03 <lambdabot> • Variable not in scope: interperse :: Char -> [Char] -> [Char]
01:03 <lambdabot> • Perhaps you meant one of these:
01:04 sanett joined
01:04 <Welkin> m_ryan: if you want them between and one both ends, just modiy the order of parameters to zipWith
01:04 Stanley00 joined
01:04 <Welkin> actually
01:05 <Welkin> > '%' : concatMap (:'%') "Batman"
01:05 <lambdabot> error:
01:05 <lambdabot> • Couldn't match expected type ‘[Char]’ with actual type ‘Char’
01:05 <lambdabot> • In the second argument of ‘(:)’, namely ‘'%'’
01:05 <Welkin> > '%' : (concatMap (:'%') "Batman")
01:05 <lambdabot> error:
01:05 <lambdabot> • Couldn't match expected type ‘[Char]’ with actual type ‘Char’
01:05 <lambdabot> • In the second argument of ‘(:)’, namely ‘'%'’
01:05 <Welkin> > '%' : concatMap (:"%") "Batman"
01:05 <Welkin> oops
01:05 <lambdabot> "%B%a%t%m%a%n%"
01:06 <Welkin> m_ryan: so many ways to do it; choose your favorite
01:06 <Welkin> or make your own
01:06 <m_ryan> this is the anser '%' : concatMap (:"%") "Batman"
01:06 <m_ryan> q: your code will return a String right?
01:06 <Welkin> yes
01:07 <m_ryan> thanks :)
01:07 <isd> I think I need to understand type families better before I'll be able to piece it together.
01:07 pent joined
01:07 <* isd> goes off to read
01:07 <Welkin> but as you can see, the first '%' is a Char, and the second "%" is a String
01:07 <Welkin> it depends on what data you are working with
01:08 <Welkin> if you want a reusable function that accepts a Char, then use something like this
01:08 <johnw> isd: type families are thankfully one of the easier ones, despite some of the documentation
01:08 edvorg joined
01:08 <johnw> isd: in another language, you'd just think of them as functions...
01:08 Supersonic112_ joined
01:09 <Welkin> > let f a = a : concatMap (:[a]) in f '%' "Batman"
01:09 <lambdabot> error:
01:09 <lambdabot> • Couldn't match expected type ‘[b]’ with actual type ‘[b] -> [b]’
01:09 <lambdabot> • Probable cause: ‘concatMap’ is applied to too few arguments
01:09 louispan joined
01:09 <Welkin> > let f a b = a : concatMap (:[a]) b in f '%' "Batman"
01:09 <lambdabot> "%B%a%t%m%a%n%"
01:09 <Welkin> fine lambdabot
01:09 <isd> johnw: I mean, yeah. the error seems to suggest that -- and the ambiguity arises because the function isnt' necessarily injective.
01:10 <Welkin> why doesn't eta reducation work there?
01:10 <Welkin> reduction*
01:10 <MarcelineVQ> because it would be wrong
01:10 <MarcelineVQ> \x -> (a : concatMap (:[a])) x
01:10 <Welkin> oh, I see
01:10 norotartagen joined
01:10 <Welkin> point-free strikes again
01:10 Kundry_Wag joined
01:11 ebzzry joined
01:11 <Welkin> @pl f a b = a : concatMap (:[a]) b
01:11 <lambdabot> f = liftM2 (.) (:) ((=<<) . flip (:) . return)
01:11 <Welkin> lol
01:12 <MarcelineVQ> meet halfway :> (a :) . concatMap (:[a])
01:12 hybrid joined
01:12 robertkennedy joined
01:14 Scip joined
01:16 Stanley00 joined
01:18 norotartagen joined
01:21 <m_ryan> Welkin: let f a b = a : concatMap (:[a]) b in f '%' "Batman" is this the function?
01:21 <Welkin> m_ryan: with the Batman and all yes
01:22 <m_ryan> i want Batman to be string variable
01:22 <m_ryan> and the % is as is how would i do that?
01:23 norotartagen joined
01:25 burtons joined
01:26 cpennington joined
01:26 m0n5t0rb4k joined
01:27 animated joined
01:27 edvorg joined
01:28 rocksuger joined
01:29 <m_ryan> i already did thanks :)
01:29 <MarcelineVQ> m_ryan: gj!
01:30 <lpaste> ExpHP pasted “the compiler's incoherent choice regarding incoherent instances” at http://lpaste.net/354119
01:31 <isd> Is there a concrete advantage to type family synonyms over functional dependencies? The reading I have done suggests that if vector was using those instead, I wouldn't be having this problem.
01:31 <ExpHP> how dost I do incoherent instances halp
01:33 harfangk joined
01:34 raycoll joined
01:34 <ExpHP> (second instance is supposed to bootstrap the class, first instance propagates it)
01:34 JeanCarloMachado joined
01:34 fDev2179 joined
01:34 <ExpHP> but the compiler loves the first instance so much that it never considers the second one
01:34 romeoh joined
01:35 norotartagen joined
01:37 SAL9000 joined
01:37 m0n5t0rb4k joined
01:39 <glguy> ExpHP: No, you just don't get to do this
01:39 <glguy> ExpHP: The fact that the instance heads are different isn't relevant to instance selection
01:39 <glguy> Turning on incoherent instances is you promising that it doesn't matter which instance is picked, that both behave the same
01:42 <c_wraith> I wonder how much people would be upset with me if I started putting duplicate incoherent instances into my libraries
01:44 JeanCarloMachado joined
01:45 haskell629 joined
01:46 edvorg joined
01:47 <robertkennedy> Does dph exist in GHC 8?
01:48 fDev2179 left
01:50 chao-tic joined
01:50 <robertkennedy> Independently: what's a good way to index a single value set with multiple inputs? Like a Sudoku puzzle
01:50 <Welkin> ?
01:50 <Welkin> a graph?
01:52 raycoll joined
01:53 eacameron joined
01:53 <robertkennedy> Hmmm. That does sound nice. Is there a repa esteemed for graphs?
01:54 <robertkennedy> *repa esteemed package
01:55 Rodya_ joined
01:57 JeanCarloMachado joined
01:57 arctictern joined
01:58 arctictern joined
01:59 arctictern joined
02:00 arctictern joined
02:00 jsgrant joined
02:00 hucksy_ joined
02:00 exferenceBot joined
02:00 arctictern joined
02:01 crobbins joined
02:04 norotartagen joined
02:05 superphunthyme joined
02:08 <ExpHP> ah, er, oops, apparently I was scrolled up and didn't see the responses
02:08 <ExpHP> but uh, thanks to whoever said the thing, which I'm sure was nice
02:08 robkennedy joined
02:09 <Cale> ExpHP: There was a warning that you shouldn't turn on IncoherentInstances
02:10 <Cale> <glguy> ExpHP: No, you just don't get to do this
02:10 <Cale> <glguy> ExpHP: The fact that the instance heads are different isn't relevant to instance selection
02:10 <Cale> <glguy> Turning on incoherent instances is you promising that it doesn't matter which instance is picked, that both behave the same
02:10 <ExpHP> Hm
02:10 patbecich joined
02:11 <Cale> ExpHP: Your two instance heads look identical to the instance resolver
02:11 <Cale> ExpHP: MonadReaders ns s (ReaderT nt m) vs. MonadReaders ns s (ReaderT ns m)
02:11 <Cale> There's no type constructor there to match on to distinguish them
02:11 FreeBirdLjj joined
02:12 <Cale> ExpHP: Something you should be aware of is that the class constraints on an instance *do not matter* when it comes to deciding which instance to use.
02:12 JeanCarloMachado joined
02:12 louispan joined
02:12 <ExpHP> Cale: :o
02:13 <Cale> They get applied only *after* committing to the instance
02:14 <Cale> The reason for that is that the compiler can never rely on the absence of an instance -- it might exist in some future module, yet to be compiled or written.
02:15 nomotif joined
02:15 space-marmot joined
02:16 <ExpHP> you mention that it needs type constructors to match, I wonder if I could somehow encode the depth of each nested instance with a natural number-y encoding in the type system...
02:16 <Cale> If it did rely on it, then decisions about which instance to use could be affected by future modules, meaning that previous stuff either needs to be recompiled, or else confusing and arbitrary choices would get made.
02:17 <ExpHP> have instances for S Foo, S (S Bar), S (S (S Baz)))...
02:17 <Cale> You could do something like that, or just do what I do and never really use the MonadReader class, apart from some early setup.
02:18 <ExpHP> hehe
02:18 <Cale> If you want to actually make things usable, either define your own classes with more meaningful operations, or at least the monomorphic operations for the monad you'll actually be using.
02:18 <ExpHP> I was trying to write something like this for State, because I wanted to just be able to plunk a layer into my stack that had some state and have methods for it "just work"
02:19 <ExpHP> with only one MonadState instance I have to tangle it all together
02:20 <Cale> I hate the word "stack" in this context, because if you have to think of it like a stack, you could probably be designing things a lot better.
02:20 exferenceBot joined
02:20 <Cale> You have a monad. It may or may not have been constructed from other monads using some monad transformers.
02:21 <Cale> If you have a few monads which have different capabilities by design, then express those through type class constraints, satisfied by the few different monads you use.
02:21 norotartagen joined
02:21 <Cale> (assuming you want the polymorphism)
02:21 Randy_ joined
02:22 <Cale> But try to make it so that outside of the small module in which you define your monad, nobody can tell you're using monad transformers.
02:22 norotartagen left
02:22 <Welkin> lol
02:22 <Welkin> "monad transformer stack"
02:22 <Welkin> it's not a transformer stack if you use the mtl typleclasses
02:23 <ExpHP> Welkin: yeah about that (scroll up)
02:23 cpup joined
02:23 <Welkin> to where?
02:23 <ExpHP> to me complaining about MonadReader
02:23 <Welkin> I'm not going to read the whole log
02:23 <Cale> Well, the term stack comes from the idea that you're going to be lifting operations different numbers of times and needing to care about all the intermediate monads along the way
02:24 <Welkin> There is also extensible effects using Free(er)?
02:24 <Cale> If you have a situation like that, probably it's worth thinking about whether you can do something better.
02:24 Trixar_za joined
02:24 <Cale> There are countless ways to defer the decision about how to implement operations, yes.
02:25 hexagoxel joined
02:25 <Cale> (though most of them will harm performance by preventing inlining)
02:25 <Cale> (sometimes that's okay)
02:25 <ExpHP> cale: okay, thanks for the explanation
02:25 e14 joined
02:25 Randy_ left
02:25 <Welkin> https://hackage.haskell.org/package/freer-effects
02:26 meba joined
02:26 <Cale> I used to have a little article about this, but it was only on a webserver on a machine whose hard drive died.
02:26 <Cale> I should rewrite it
02:26 buglebudabey joined
02:26 Rodya_ joined
02:26 leshow joined
02:27 <leshow> is there a way to get ghc to give me it's function signature for an instance?
02:27 pavonia joined
02:27 <Welkin> leshow: look up the typeclass definition
02:27 <leshow> like, I want to try implementing lift in MonadTrans for StateT, can I get ghc to spit out the signature for that
02:27 <Cale> :t lift
02:27 <leshow> I mean with StateT substituted in
02:27 <lambdabot> (Monad m, MonadTrans t) => m a -> t m a
02:28 <Cale> (Monad m) => m a -> StateT s m a
02:28 <Cale> hmm
02:28 <leshow> isn't it like StateT s m a -> t (StateT s m a)
02:29 <Cale> no
02:29 <Cale> It's what I said :)
02:29 <Cale> lift takes an action in your original monad, and turns it into an action in the transformed monad
02:30 <leshow> so we're transforming it into a StateT action? from some other action?
02:30 <Cale> yes
02:30 <Cale> From an m action to a (StateT s m) action
02:30 <leshow> ok
02:30 raycoll joined
02:30 sanett joined
02:30 WhiskyRyan joined
02:31 jpg joined
02:32 <leshow> why do people use liftM instead of fmap, they look like they do the same thing
02:32 <Welkin> leshow: they don't
02:32 <Welkin> :t fmap
02:32 <lambdabot> Functor f => (a -> b) -> f a -> f b
02:32 <Welkin> oh
02:32 <Welkin> yeah
02:32 <Welkin> liftM, not lift
02:32 Fylwind joined
02:32 <Welkin> liftM is old
02:32 <Welkin> fmap replaced it and is more general
02:32 <leshow> like mapM and traverse?
02:32 <Welkin> kind of like return and pure
02:32 <leshow> you can use pure in a monad now? instead of return?
02:32 <Welkin> yes
02:33 jsgrant joined
02:33 <Welkin> return = pure
02:33 JeanCarloMachado joined
02:33 <leshow> cool, i think purescript does that
02:34 <Cale> Well, liftM still serves a useful purpose
02:34 <Welkin> :t liftM
02:34 <lambdabot> Monad m => (a1 -> r) -> m a1 -> m r
02:34 <Welkin> Cale: it does?
02:34 <MarcelineVQ> liftM is possibly useful in that when you say liftM you really mean to be using a Monad and ghc will let you know if there isn't one
02:34 <Cale> liftM is defined in terms of return and >>=
02:34 <Cale> So if you have your Monad instance written and want a Functor instance
02:34 <Cale> you can write fmap = liftM
02:34 <Welkin> yeah
02:34 danthemyth joined
02:34 <Welkin> that makes sense
02:35 <leshow> is monadtransformers still the popular way to go about composing applications
02:35 <Cale> leshow: They're a popular way to compose... monads.
02:36 <Cale> Defining an application specific monad is sometimes a good plan, sometimes a bit frivolous
02:36 <leshow> most web frameworks seem to use them, is there another strategy that's popular?
02:36 <Cale> Well, yeah, it's a little bit unfortunate.
02:36 <Cale> Not always the worst thing -- some cases are better than others.
02:37 <Welkin> I mentioned freer
02:37 <Welkin> https://hackage.haskell.org/package/freer-effects
02:37 <Welkin> extensible effects is very interesting
02:37 <Cale> You can just... write your program and not worry about defining monads.
02:37 <Welkin> it's used in purescript
02:37 crobbins joined
02:37 <Welkin> I'll generally define a newtype App that is ReaderT
02:38 <Welkin> to store global config information for an application
02:38 JeanCarloMachado joined
02:38 <Cale> Sometimes that's nice, but I'd usually avoid moving away from IO to some other monad just for ReaderT
02:39 <leshow> whats the performance like for freer? Is everything interpreted at run time?
02:39 <Cale> You pay in liftIO what you made up in parameter passing
02:39 <leshow> you're making a DSL basically right, that gets interpreted?
02:40 <Cale> and you make things like bracket, forkIO, withMVar, catch, etc. etc. annoying to use
02:42 chipmadness joined
02:42 <chipmadness> does anyone know why this is not working? I don't know why it is yelling at me because of "then"
02:42 <chipmadness> displayNevenRecursive n k = if(k <= n && k%2==0 then print(displayNevenRecursive n k++) else if k <= n then displayNevenRecursive n k++ else return)
02:43 <chipmadness> basically, i am making a recursive function that counts to N but only shows even numbers to N
02:43 <Cale> What the...
02:43 <Cale> You're partially applying ++
02:43 <Cale> ?
02:43 <MarcelineVQ> that's not quite how haskell if's are written
02:43 <leshow> why are you return-ing
02:44 <chipmadness> returning because its done. if k is past N, then stop counting
02:44 argent0 joined
02:44 JeanCarloMachado joined
02:44 <leshow> thats not what return does
02:44 Koterpillar joined
02:44 <Cale> Yeah, and that return doesn't make sense -- return is a function, which makes an action that does nothing except to return the given value as its result
02:44 <chipmadness> oh, I didn't look that part up, I was thinking in C++ terms
02:44 <Cale> You might be able to put return () there
02:44 <Cale> also, your parens are super weird
02:45 <Cale> if( <-- I think this paren is out of place
02:45 <ExpHP> Let's start with the easy fixes
02:45 <chipmadness> this example I read uses paran -> doubleSmallNumber' x = (if x > 100 then x else x*2) + 1
02:45 <ExpHP> chipmadness: ++ in haskell is string concatenation. You probably want (k+1)
02:46 sleffy joined
02:46 <Cale> That's using parens to group the if expression
02:46 <ExpHP> er, list concatenation. Same thing.
02:46 post-ironic joined
02:46 <Cale> and note that the ( is outside the if
02:46 <Welkin> lol cale
02:47 <chipmadness> LOL
02:47 <chipmadness> i am blind, now it hates my else
02:47 <Cale> (displayNevenRecursive n k++) would be the function which concatenates the list displayNevenRecursive n k with whatever list it's supplied
02:47 <Cale> > ([1,2,3] ++) [4,5]
02:47 <lambdabot> [1,2,3,4,5]
02:47 sanett joined
02:48 <Cale> > map ([1,2,3] ++) [[4,5], [6,7]]
02:48 <lambdabot> [[1,2,3,4,5],[1,2,3,6,7]]
02:48 <leshow> you probably want mod too, not %
02:48 enitiz joined
02:48 <Cale> Yeah, or just even
02:48 <Cale> > even 5
02:48 <lambdabot> False
02:48 <Welkin> use case and guards instead of if then else
02:48 <Cale> > even 6
02:48 <lambdabot> True
02:48 allenj12 joined
02:48 <chipmadness> oh true
02:48 <Welkin> if-then-else is messy and unidiomatic except for very simple predicates
02:48 <chipmadness> i forgot ++ is concat
02:49 <chipmadness> i want it to plus by 1
02:49 <chipmadness> += 1
02:49 <Cale> n + 1
02:49 <Cale> ?
02:49 <Cale> n is whatever number it is
02:49 <allenj12> how do you x^n where x is a Double and n is an integer?
02:50 jao joined
02:50 <ExpHP> x**n
02:50 <Cale> allenj12: Just like that
02:50 <Cale> Well, if you want negative values of n, use ^^
02:50 <ExpHP> actually yeah what Cale said
02:50 <allenj12> Cale: getting a type error, hmmm
02:50 <Cale> > (pi :: Double)^(6 :: Integer)
02:50 <lambdabot> 961.3891935753043
02:50 <Cale> > (pi :: Double)^(-6 :: Integer)
02:50 <lambdabot> *Exception: Negative exponent
02:50 <Cale> > (pi :: Double)^^(-6 :: Integer)
02:50 <allenj12> Cale: its probably something else thanks maybe i can post the function. its really confusing me
02:50 <lambdabot> 1.0401614732958525e-3
02:50 <Cale> lpaste.net :)
02:51 <Sornaensis> :t (^^)
02:51 <lambdabot> (Integral b, Fractional a) => a -> b -> a
02:51 <Sornaensis> :t (**)
02:51 <lambdabot> Floating a => a -> a -> a
02:51 <leshow> http://lpaste.net/354122
02:51 <leshow> that's similar to your first function
02:52 <leshow> probably still crappy, I'm new to haskell also
02:52 <Cale> I think he actually wanted to increment k
02:52 JeanCarloMachado joined
02:52 <allenj12> eToThe x = (1+) $ sum $ foldl (+) 0 (map (\n -> (x^n)/(fact n)) [1..11]) fact :: Int -> Int. I get expected type [Double] and got Double in first argument of ^
02:52 <leshow> he said count to k printing evens, I think
02:52 <Cale> ah
02:52 <chipmadness> yeah
02:52 <chipmadness> thank you leshow
02:53 <Cale> Well, I would just write mapM print (filter even [k..n])
02:53 <leshow> yeah, I just wanted to make it like his original function, so it might make more sense
02:53 <chipmadness> Cale: displayNevenComprehension n = print([x*2 | x <- [1..n], x*2 <= n])
02:53 <chipmadness> i did :)
02:53 <Cale> allenj12: You probably want to apply fromIntegral to the fact n
02:54 <Cale> allenj12: It needs to be a Double so that you can divide by it.
02:54 <Cale> :t (/)
02:54 <lambdabot> Fractional a => a -> a -> a
02:54 JoshS joined
02:54 <Cale> also, you really don't need that 1 + out front
02:54 <Cale> well, and you're summing twice?
02:55 <leshow> Cale, mapM_ right?
02:55 <leshow> because we dont want a return value
02:55 np356 joined
02:55 <Cale> leshow: yes
02:55 <post-ironic> Stupid question: in my simple hailstone iteration count program, I want it to take in an integer and return an integer. It will be recursive with a pattern for odd and even. But how do I increment the iteration counter with each iteration and pass it to the next call?
02:55 <Cale> post-ironic: n+1?
02:55 <Cale> and then just... pass that along?
02:55 <allenj12> Cale: that one was a typo.. anyway it works now... sort of
02:56 <Cale> allenj12: note that x^0 = 1
02:56 <Cale> (even when x = 0)
02:56 <Cale> > 0^0
02:56 <lambdabot> 1
02:56 <post-ironic> @cale Can I do that without making it take in two arguments?
02:56 <lambdabot> Sorry, look up one word at a time please.
02:56 <chipmadness> i see print is more like println, how do i make it so it doesn't do a new line?
02:56 <ExpHP> post-ironic: write an inner function
02:56 <Cale> post-ironic: I can't tell. Maybe not, if the result of the operation depends on both.
02:57 <Welkin> chipmadness: print is defined as `putStrLn . show`
02:57 <Welkin> you must want putStr
02:57 <leshow> putStr
02:57 <ExpHP> post-ironic: outer n = inner k n where ...
02:57 <Cale> post-ironic: Functions have to produce their result based only upon the arguments you give them. There's nothing else their result can depend on.
02:58 <ExpHP> (I meant inner 0 n; the definition of outer is where you would initialize extra arguments)
02:58 <Cale> right
02:58 <post-ironic> Cale Yes but I'm sure there is a way to do this. I will look into an inner function, thank you
02:58 xtreak joined
02:58 <Cale> Yeah, just define a second function to begin with. You can move it into a where clause after
02:59 <chipmadness> Welkin: doesn't putStr only work with char? I need it for Int
02:59 <allenj12> Cale: updated version eToThe x = sum $ map (\n -> (x^n)/(fromIntegral (fact n))) [0..11] , but getting NaN when passed 0 and infinity when passed 1 :(
02:59 <Cale> post-ironic, chipmadness, others: A general technique for translating imperative programs if you're lost is to turn each point of control in your imperative program into a function, and each mutable variable in scope there into a function parameter
02:59 <leshow> is there a traverse that throws away the result, like mapM_
03:00 <Cale> Then you have each function apply the next according to your program's control flow.
03:00 <Cale> This will generally result in a mess, but it will be a mess of *equations*
03:00 tromp joined
03:00 <Cale> and you can simplify that the same way you'd simplify expressions in highschool algebra by plugging one equation into another and eliminating them.
03:01 <Welkin> wedens: what...
03:01 <Welkin> chipmadness: what...
03:01 <post-ironic> Cale Not sure I understand how a function can replace a variable
03:01 <Welkin> :t putStr -- chipmadness
03:01 <lambdabot> String -> IO ()
03:01 <Cale> post-ironic: A function replaces a point of control in your program
03:01 <Welkin> if you can something that is not a String, you can apply `show` over it
03:01 <Welkin> :t show -- chipmadness
03:01 <lambdabot> Show a => a -> String
03:02 <Welkin> :t putStr . show -- chipmadness, like this
03:02 <lambdabot> Show a => a -> IO ()
03:02 <Cale> post-ironic: i.e. the function will compute the final result of your imperative program, starting from that point, with its arguments being the current values of the mutable variables
03:02 <Cale> post-ironic: So you'd start out with a function for almost every line
03:03 <Cale> and if you have a loop, it will turn into (mutual) recursion
03:03 <Cale> because the function for the line at the end of the loop will apply the function for the start of the loop (or the loop test or whatever)
03:04 splanch joined
03:04 ddere joined
03:04 <Cale> and ordinarily, each function will apply the next to whatever the new values for the variables are (often the same, unless you've updated them)
03:05 ode joined
03:06 <post-ironic> Cale my brain.exe stopped working
03:06 <Cale> I'll see if I can make you a simple example
03:06 <Welkin> post-ironic: that's because it's running winows
03:06 <Welkin> windows
03:07 aarvar joined
03:07 <post-ironic> it's running in wine on gentoo linux
03:07 utdemir joined
03:07 CurryWurst joined
03:09 <dmwit> chipmadness: `print = putStrLn . show`, so perhaps you would like `printNoLn = putStr . show`.
03:09 <chipmadness> I got it working, thanks dmwit
03:10 <dmwit> Oh, I missed Welkin's answer. Sorry about that.
03:12 Kundry_Wag joined
03:13 conal joined
03:14 <chipmadness> http://lpaste.net/4885411465386786816
03:14 <dmwit> allenj12: Did you get an answer?
03:14 <chipmadness> I am trying to use this example now, but instead put it to a list
03:14 <dmwit> allenj12: If not, you should show your `fact`. When I paste your code into a file and implement `fact` myself it works fine.
03:14 <chipmadness> in the end, I want it to print the list
03:14 <utdemir> Hey. I have a template haskell function that generates some data type (String -> DecsQ). Now I also want to generate lenses using Control.Lens.TH.makeLenses function. But when I do that, it gives me "MyData is not in scope at a reify". I can understand the problem that makeLenses wants to reify to get my data structure, but it isn't defined yet. But I don't know a way to solve this. Can somebody help me?
03:14 <Welkin> chipmadness: consider breaking your function into smaller parts
03:14 <chipmadness> xs ++ n should add n to the end of the list correct?
03:14 <post-ironic> Cale wait maybe you are supposed to define an inner function that increments a variable counting iterations and calls the function to do the next iteration?
03:15 <Welkin> a pure part, and an impure part
03:15 <leshow> chipmadness, why do all that, when you can just do filter even [0..k]
03:15 <allenj12> dmwit: sorry its working fine now (the numbers are wrong) but there close logic error now
03:15 <Welkin> keep your IO separate from your computations
03:15 <chipmadness> i am screwing with recursion leshow
03:16 <dmwit> chipmadness: A question to ponder: why do you feel you need to fill in the `n` and `k` arguments when recursing on `displayNevenRecursion`, but do not need to fill in the `xs` argument?
03:17 <leshow> http://lpaste.net/4885411465386786816
03:17 <lpaste> Cale pasted “Translating imperative to functional, the mechanical way, step 1” at http://lpaste.net/354124
03:17 <leshow> can get rid of that do probably
03:17 <chipmadness> crap, I pasted the wrong code: sorry dmwit
03:17 <leshow> (:) is the cons operator
03:17 <Cale> ^^ see that paste for an example of what you might get doing this very mechanically
03:17 <Cale> Now I'll start simplifying it...
03:18 <chipmadness> thank you leshow
03:19 <ExpHP> Cale: Have you heard of this thing called GOTO?
03:19 <ExpHP> crap I forgot the winky emoticon
03:20 <chipmadness> leshow, how come it is backwards?
03:20 <chipmadness> it counts down
03:20 <chipmadness> I tried switching the (:)
03:20 <leshow> I never ran it, I just wrote your code in a way that compiles
03:20 <leshow> try playing with it
03:20 <chipmadness> Haskell is just so picky
03:20 <chipmadness> or i am too leanent
03:20 <leshow> or you just don't know any of the functions lol
03:21 <chipmadness> ^^^^^^^^^^^^^
03:21 <dmwit> Cale: I think you lost the `k := k+1` line.
03:21 <dmwit> Cale: Or rather, you have it, but didn't "do" it, in `f5`.
03:21 <glguy> utdemir: did you get that working?
03:21 <leshow> you may want the (++) operator, to append to the end of a list. try some variations of that to get a feel for it
03:22 <leshow> function, not operator
03:22 <leshow> old habit lol
03:22 <chipmadness> oky
03:22 <chipmadness> okay
03:22 m1911 joined
03:22 <Cale> dmwit: you're right, I'll edit it :)
03:23 <lpaste> Cale revised “Translating imperative to functional, the mechanical way, step 1”: “Translating imperative to functional, the mechanical way, step 1” at http://lpaste.net/354124
03:23 gibransr joined
03:24 <glguy> utdemir: The order matters, make sure you're defining the datatype above where you're making lenses
03:25 <lpaste> Cale annotated “Translating imperative to functional, the mechanical way, step 1” with “Translating imperative to functional, the mechanical way, step 1 (annotation)” at http://lpaste.net/354124#a354127
03:25 eacameron joined
03:26 <Cale> and there's an annotation with simplification steps
03:26 systadmin joined
03:26 dan_f joined
03:27 <Cale> post-ironic, chipmadness: http://lpaste.net/354124 -- hopefully this gives an impression of what I mean
03:27 <Cale> Of course, you usually wouldn't write all this out
03:27 <Cale> You might even go directly to the end result, after a bit of practice
03:28 <post-ironic> Cale Yes I see how you would have something with local variables by defining a new function now. thank you
03:28 <Cale> But I think it's good when you're starting out to have something you can kind of fall back on as a way to translate things
03:30 <Cale> I've actually done this to obfuscated C code before to try to understand what it was doing :)
03:30 asivitz joined
03:30 m0n5t0rb4k joined
03:32 <chipmadness> Wow thanks Cale
03:33 felixsch_ joined
03:35 doomlord joined
03:36 mounty joined
03:37 WhiskyRyan joined
03:38 np356 joined
03:39 <lpaste> allenj12 pasted “whats the difference? Haskell math help!” at http://lpaste.net/4892280702936023040
03:39 <chipmadness> is there any way to build a one liner out of this? I feel it is too complicated for what it is: https://paste.ofcode.org/HFZfqsdQEwubp7UPVyyW5d
03:39 event_null joined
03:39 <Cale> > product [1..11]
03:39 <allenj12> Cale: if your still here I was wondering if you could check that post out
03:39 <lambdabot> 39916800
03:39 <allenj12> ugh theres a typo
03:40 falafel joined
03:40 <allenj12> its [0..10]
03:40 <allenj12> not to 11
03:40 <chipmadness> LOL i know that, but I want to make my own product
03:40 Maxdaman1us joined
03:40 <lpaste> allenj12 revised “whats the difference? Haskell math help!”: “whats the difference? Haskell math help!” at http://lpaste.net/4892280702936023040
03:40 systadmin joined
03:40 <Welkin> > foldl1' (*) [1..10]
03:40 <Cale> Yeah, well, that last term ought not to matter too much
03:40 <lambdabot> 3628800
03:41 <Welkin> > product [1..10]
03:41 <lambdabot> 3628800
03:43 xtreak joined
03:43 sellout- joined
03:43 <dmwit> allenj12: It's actually [0..9], isn't it?
03:43 <dmwit> > take 10 [0..]
03:43 <lambdabot> [0,1,2,3,4,5,6,7,8,9]
03:43 <Cale> yeah, hah, beat me to it
03:44 <Cale> Actually, it matters quite a lot that you're truncating the series
03:44 <Cale> > exp 20
03:44 <lambdabot> 4.851651954097903e8
03:44 <allenj12> ugh, yea thats it :( lol
03:44 <dmwit> Yeah, the observation that made me scratch my head was that the final terms in the sum were contributing quite a lot to the actual value.
03:45 <dmwit> chipmadness: `product = foldl' (*) 1` is another way to spell it
03:45 <Cale> 20 is far enough away from 0 that the convergence isn't terribly fast
03:46 <dmwit> chipmadness: (Actually I guess what you wrote is `foldr (*) 1`. But `(*)` is associative and commutative, so...)
03:46 <chipmadness> thanks everyone
03:47 <Cale> We can actually extract the definition of foldr from that, by abstracting out the (*) and 1 into parameters :)
03:48 <Cale> You might also have written
03:48 <Cale> sum' [] = 0; sum' (x:xs) = x + sum' xs
03:48 FreeBirdLjj joined
03:48 hhf joined
03:49 <Cale> and noticing the similarity between this code and the code for product (and the code for concat, and a bunch of other stuff), you might try abstracting out the bits which are different
03:50 otto_s_ joined
03:51 sz0 joined
03:51 louispan joined
03:51 sullyj3 joined
03:52 hhf joined
03:54 Sh4rPEYE joined
03:54 mizu_no_oto joined
03:55 spatial joined
03:55 splanch joined
03:56 <spatial> Passing an array around nested functions http://lpaste.net/354128 Is arr updated ?
03:56 <spatial> The array 'arr' is being read and written.
03:57 castlelore joined
03:57 castlelore joined
03:57 snowalpaca joined
03:57 <ExpHP> > let id = foldr (:) []
03:57 <lambdabot> <no location info>: error:
03:57 <lambdabot> not an expression: ‘let id = foldr (:) []’
03:58 <ExpHP> > let id = foldr (:) [] in id [3,6,1,7,3,6,7]
03:58 <lambdabot> [3,6,1,7,3,6,7]
03:59 <pavonia> spatial: What do you mean by updated?
03:59 <spatial> It is an IOArray
04:00 nomicflux joined
04:00 <pavonia> You say it's written to it, so would that count as updating?
04:00 tempname11 joined
04:00 <spatial> writethevalue arr i (v+1) Yes
04:01 gillesmajor joined
04:01 gillesmajor left
04:02 Valerie joined
04:02 Rodya_ joined
04:03 arctictern joined
04:04 sanett joined
04:04 Netwolf joined
04:05 systadmin joined
04:06 <spatial> Question is about the bindings that are reused
04:06 xall joined
04:06 eacameron joined
04:07 alecbrick joined
04:07 eazar001 joined
04:08 <pavonia> You should probably rephrase/elaborate your question, I have no idea what you're asking for
04:10 <spatial> pavonia: I have 'arr' which is an IOArray. Read and Write functions are tested separately. They use ReaderT and liftIO.
04:11 WhiskyRyan joined
04:11 <spatial> pavonia:I have nested functions that pass the parameters around. Is 'arr' binding correctly used so that the same array is read and written to ?
04:13 <pavonia> Yes, there only in one array being passed around here
04:14 <pavonia> You don't even need that arr parameter in the loop function because the outermost arr is already in scope
04:14 argent0 joined
04:15 <spatial> Ok
04:17 Goplat joined
04:18 eklavya joined
04:18 efank joined
04:22 vlatkoB joined
04:23 juhp joined
04:24 robotroll joined
04:27 meba joined
04:27 hhf joined
04:28 ExpHP joined
04:28 enitiz joined
04:29 mbuf joined
04:29 tromp joined
04:32 tromp joined
04:37 <event_null> lots of in and out traffic for such little conversation
04:38 event_null left
04:38 geekosaur joined
04:39 Sose joined
04:41 FreeBirdLjj joined
04:44 Micamo joined
04:47 ljhms joined
04:48 sanett joined
04:48 sypwex joined
04:49 inad922 joined
04:53 kyle1320 joined
04:56 cyborg-one joined
04:56 yellowj joined
04:58 sanett joined
05:00 splanch joined
05:02 Jesin joined
05:02 augur joined
05:04 Rodya_ joined
05:05 dec0n joined
05:06 geekosaur joined
05:07 ljhms joined
05:08 bungoman joined
05:10 edsko joined
05:10 Maven joined
05:12 lambda-11235 joined
05:14 JoshS joined
05:15 Kundry_Wag joined
05:15 dec0n joined
05:15 cryo28 joined
05:16 ludat joined
05:17 louispan joined
05:18 ludat joined
05:18 mstruebing joined
05:18 <qmm> is there a way to search through hackage for all packages that derive an instance of a typeclass?
05:18 <qmm> a specific typeclass
05:18 ludat joined
05:19 Swizec joined
05:19 <qmm> e.g. i am interested in finding all instances of a functor
05:19 mmachenry joined
05:21 <geekosaur> hayoo can do it but that's going to be a painfully large list
05:21 splanch joined
05:22 dcluo joined
05:22 Swizec_ joined
05:23 sanett joined
05:23 meandi_2 joined
05:24 FreeBirdLjj joined
05:28 meba joined
05:29 <lapinot> me again... my little code that does normalization by evaluation on HOAS has grown a bit by undergoing a CPS transformation but I fail to make things typecheck.. I have a result type O (the codomain of continuations) which is a GADT. I would be happy to add a constructor Final :: a -> O a so that i can effectively have some sink to get the final value. The problem is that if I can't find types so that O has
05:29 <lapinot> kind * -> * (effectively "storing" the type of the final result, thus typechecking when extracting from Final). When O "forget" the type (kind *) then everything typechecks
05:30 jhrcek joined
05:30 dfeuer joined
05:30 <lapinot> the code is here: https://ptpb.pw/mM4g, if anyone is insterested in this, please take a look, if you have any idea I would be happy :)
05:32 brynedwardz joined
05:32 danvet joined
05:37 <lapinot> oh forget it :) adding a type annotation just solved it
05:39 uglyfigurine joined
05:42 <lapinot> or not... anyway, i'm getting forward!
05:42 kyle1320 joined
05:43 kyle1320 joined
05:45 hybrid joined
05:45 kyle1320 joined
05:45 pikajude joined
05:45 ali_bush joined
05:45 ali_bush joined
05:47 kyle1320 joined
05:48 itachi joined
05:49 kyle1320 joined
05:50 rocksuger left
05:51 Xanather joined
05:51 ljhms joined
05:51 inad922 joined
05:54 mda1 joined
05:56 osa1 joined
05:56 osa1 joined
05:59 kritzcreek_ joined
06:01 xinming_ joined
06:04 Gurkenglas_ joined
06:05 vtomole joined
06:05 Rodya_ joined
06:05 eacameron joined
06:06 zcourts joined
06:06 wlemuel joined
06:09 raichoo joined
06:12 bob_ joined
06:12 FreeBird_ joined
06:13 ralu joined
06:16 dcluo joined
06:18 eklavya joined
06:21 takuan joined
06:22 zeroed joined
06:22 Ferdirand joined
06:26 <spatial> Can IOArray Int Double hold null for a particular value ? I use 0 to represent null.
06:27 <spatial> Lisp seems to use nil.
06:28 eacameron joined
06:32 Edith joined
06:32 quchen joined
06:32 [scrooge] joined
06:33 fendor joined
06:34 sanett joined
06:34 <liste> spatial: you can use Maybe Doublew
06:34 <liste> Maybe Double*
06:34 <liste> :t Just 4.0
06:34 <lambdabot> Fractional a => Maybe a
06:35 <liste> > ([Just 4.0, Nothing] :: [Maybe Double])
06:35 <lambdabot> [Just 4.0,Nothing]
06:35 robertkennedy joined
06:35 RevJohnnyHealey joined
06:36 darkSeid_ joined
06:37 <spatial> arr <- newArray (0,bins) 0; Default value is 0. How does this change ?
06:39 <cocreature> spatial: just replace 0 by whatever you want the default value to be?
06:39 enitiz_ joined
06:39 KarboniteKream joined
06:41 pikhq joined
06:41 sanett joined
06:41 eacameron joined
06:42 sanett joined
06:44 oish joined
06:44 sanett joined
06:44 eazar001 joined
06:45 <itachi> Hi guys is there anyplace or book where I can find questions on monad or monoids?
06:47 arawack joined
06:47 <cocreature> itachi: afaik http://haskellbook.com/ contains a lot of exercises
06:47 alfredo joined
06:49 sypwex joined
06:50 <itachi> cocreature does it also have solutions?
06:51 <cocreature> itachi: not sure
06:51 orbifx joined
06:51 <itachi> k thanks
06:52 Denthir joined
06:54 Swizec joined
06:54 free_beard joined
06:55 laz joined
06:55 biglama joined
06:56 dcluo joined
06:57 MoALTz joined
06:58 xificurC joined
06:58 abrick joined
06:58 ragepanda joined
07:00 albertid joined
07:03 jgertm joined
07:03 unK_ joined
07:04 fred-fri joined
07:05 fendor joined
07:05 <fred-fri> https://www.hackerrank.com/challenges/diagonal-difference Wrote a quick and dirty Java solution https://pastebin.com/1EtaRW1D but struggling to solve it in Haskell. I'd be interested to see any solution anyone might come up with.
07:05 Denthir joined
07:06 Itkovian joined
07:06 louispan joined
07:06 RayNbow`TU joined
07:06 plutoniix joined
07:06 dan_f joined
07:07 <jle`> fred-fri: are you asking for a direct translation of your java solution?
07:08 <jle`> > map (map read . unwords) . unlines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
07:08 <lambdabot> error:
07:08 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
07:08 <lambdabot> Expected type: [String] -> [String]
07:08 <jle`> > map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
07:08 <lambdabot> [[1,2,3],[4,5,6],[7,8,9]]
07:08 danvet joined
07:09 <jle`> > zipWith drop [1..] . map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
07:09 <lambdabot> [[2,3],[6],[]]
07:09 <jle`> hm
07:09 <jle`> > zipWith drop [0..] . map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
07:09 <lambdabot> [[1,2,3],[5,6],[9]]
07:09 <jle`> oh, well
07:09 <jle`> > sum . zipWith (flip (!!)) [0..] . map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
07:09 <lambdabot> error:
07:09 <lambdabot> • No instance for (Num [[Int]]) arising from a use of ‘sum’
07:09 <lambdabot> • In the first argument of ‘(.)’, namely ‘sum’
07:09 ventonegro joined
07:10 <jle`> hopefully that's good enough of a hint to start from
07:12 guiben joined
07:12 raduom joined
07:13 mazeinmaze_ joined
07:15 vlatkoB joined
07:15 dcluo joined
07:16 Kundry_Wag joined
07:18 fizruk joined
07:19 mfukar joined
07:20 bob_ joined
07:22 connrs joined
07:22 eklavya joined
07:25 oish joined
07:25 fendor joined
07:26 weualo joined
07:27 thc202 joined
07:28 bollu joined
07:29 meba joined
07:30 ubsan_ joined
07:30 patbecich joined
07:32 sanett joined
07:33 MindlessDrone joined
07:34 freusque joined
07:36 BartAdv joined
07:36 zcourts joined
07:37 mattyw joined
07:38 KarboniteKream joined
07:39 eacameron joined
07:39 uncertainty joined
07:40 henriksod joined
07:40 patbecich joined
07:40 <bollu> cocreature: ping
07:42 zcourts_ joined
07:44 eacameron joined
07:45 sz0 joined
07:45 significance joined
07:46 darkSeid_ joined
07:46 <significance> Hey all! Haskell noob here -- I wrote a really simple program as an exercise here (https://gist.github.com/useanalias/1780ea3f48f27250a27c7dbeefe6f7c1) and it runs fine for positive input, but for negative input, it complains of a "non type-variable argument in the constraint: Num (a -> a -> a)." What might be going on?
07:46 oish joined
07:47 <quchen> significance: (-) is the "subtract" function,
07:47 <quchen> > (-) 10 1
07:47 <lambdabot> 9
07:47 <quchen> That’s the same as
07:47 <quchen> > 10 - 1
07:47 <lambdabot> 9
07:48 <quchen> Use »negate« to flip the sign,
07:48 <quchen> > negate 2
07:48 <lambdabot> -2
07:48 <significance> Ohh, is (+) different?
07:48 <significance> > (+) 3 2
07:48 <lambdabot> 5
07:48 <quchen> (+) follows the same principle.
07:48 <jle`> it's the same, but it's probably how you are calling it
07:48 <jle`> significance: are you calling it 'stepReverseSign -1' ?
07:48 <quchen> You can use an infix function as prefix if you enclose it in parentheses.
07:48 <jle`> becuase haskell doesn't like that
07:48 raichoo joined
07:48 <quchen> > (*) 3 4
07:48 <lambdabot> 12
07:48 <significance> jle`: I'm calling it with two arguments :)
07:48 <quchen> > (/) 10 2
07:49 <lambdabot> 5.0
07:49 <jle`> significance: can you post how you are calling it
07:49 <hvr> quchen: and now explain -XNegativeLiterals :-)
07:49 <significance> jle`: sure: stepReverseSign -3 1 from ghci
07:49 <jle`> significance: ah, yeah
07:49 <jle`> try stepReverseSign (-3) 1
07:49 <quchen> hvr: Not Haskell :-þ
07:49 <jle`> the problem is that haskell interprets - as an operator, there
07:49 <jle`> so it's parsed as stepReverseSign - 3 1
07:49 <significance> ohh, derp -- thank you!
07:50 <jle`> or stepReverseSign - (3 1)
07:50 <jle`> it's definitely unintuitive, and very different from most other programming languages, so you can't blame yourself
07:50 <hvr> quchen: ...not yet =)
07:50 <significance> thank you!
07:50 <jle`> no problem!
07:51 <quchen> hvr: »I should do something for Haskell’« is something that bugs me every day :-S
07:51 <jle`> the - token is kind of weird anyway in haskell
07:51 <quchen> … to varying avail
07:51 <hvr> quchen: yeah, I know... same here
07:52 <hvr> but there's unfortunately other parts of the ecosystems that have currently higher prio for me
07:53 sword865 joined
07:54 Levex joined
07:55 <quchen> hvr: Dug up a mainframe again? ;-)
07:55 itachi joined
07:56 aglorei1 joined
07:56 Unhammer joined
07:57 Salih joined
07:59 raynold joined
07:59 aowi1 joined
08:01 darjeeling_ joined
08:01 augur joined
08:02 uncertainty joined
08:06 baldrick joined
08:06 yinn joined
08:06 Yuras joined
08:07 Rodya_ joined
08:08 raichoo joined
08:08 lep-delete joined
08:09 raduom joined
08:11 saep joined
08:12 np356 joined
08:13 sypwex joined
08:14 Yuras joined
08:15 detrumi joined
08:16 ahri joined
08:16 FreeBirdLjj joined
08:17 puregreen joined
08:18 trin joined
08:18 Sose joined
08:18 zero_byte joined
08:18 Beetny joined
08:19 jgertm joined
08:19 <cocreature> bollu: pong you need to go via the FFI, e.g., https://github.com/llvm-hs/llvm-hs/blob/llvm-4/llvm-hs/test/LLVM/Test/OrcJIT.hs#L82
08:20 prkc joined
08:20 <ahri> i have a function returning "Either Error [Event]" - in the Right case i want to go through each Event, passing it to a function that returns "Maybe Database" - this is for a unit test, and really i don't care about the intermediate results, only the final Database value. can i do this in a one-liner? it feels like i should be able to but the 2 monads involved confuse me a bit
08:21 ByronJohnson joined
08:21 DataComputist joined
08:21 <cocreature> ahri: so you have "Either Error [Event]" and "Event -> Maybe Database". what should the type of the result be?
08:21 <ventonegro> ahri: funcA >>= traverse funcB
08:22 <ahri> cocreature: the end result can be "Maybe Database"
08:22 mattyw joined
08:22 <ahri> ventonegro: traverse? hm, i'll look that up!
08:23 vaibhavsagar joined
08:23 <ventonegro> ahri: in this case the Traversable is the list [Event] and the Applicative is Maybe
08:23 <ventonegro> > :t traverse
08:23 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
08:24 <cocreature> ahri: so in the case of Left Error this should map to Nothing? and what happens if you get a database for multiple events?
08:25 <cocreature> ahri: and what happens if you get Nothing for some of the events and Just db for others?
08:25 Aruro joined
08:25 splanch joined
08:26 merijn joined
08:26 <KorriX> Hello! Is there any easy way of writing catMaybes for list of tuples with Maybes as fst? ( [(Maybe a, b)] -> [(a,b)] )
08:26 juhp joined
08:27 <ahri> cocreature: if any of the events result in a Nothing, the end result would be a Nothing; i want to sequentially apply the events, one by one, to the Database, and give up if any of the events are invalid
08:27 <KorriX> Possibly as some kind of lens/arrow oneliner
08:29 minato joined
08:29 augur joined
08:29 <Aruro> KorriX: traversable would be nice to go from [Maybe a] to Maybe [a]
08:29 <Aruro> but your structure is more than that
08:29 marr joined
08:29 <merijn> KorriX: What should happen if your Maybe is Nothing?
08:30 <Gurkenglas_> :t mapMaybe (_1 id) :: [(Maybe a, b)] -> [(a, b)] -- KorriX
08:30 <lambdabot> [(Maybe a, b)] -> [(a, b)]
08:30 zeroed joined
08:30 zeroed joined
08:30 <KorriX> merijn: Whole tuple should disappear from list
08:30 <Gurkenglas_> He did mention catMaybes
08:31 mkoenig joined
08:31 <KorriX> Gurkenglas: Thx, this is what I wanted
08:31 beerdrop joined
08:32 <Aruro> how do people work with arrow keys on terminal? does standard library offer any support of them?
08:33 <merijn> Aruro: You mean "how do I do interactive line editing on input?"
08:34 systadmin joined
08:34 <Aruro> no, i mean how i detect that user pressed up or down key, i need to change some parameter based on that
08:34 eatman_ joined
08:35 <KorriX> Aruro: You should be able to just use getchar
08:35 <geekosaur> not for arrows
08:35 ichor joined
08:35 <geekosaur> at least not on linux/os x
08:35 <Aruro> its gets ugly on non letter symbols
08:35 <merijn> Aruro: That very much depends on what kinda program you're trying to write, depending on that there's 2 answers
08:35 <geekosaur> you'll want to use vty/brick or hscurses
08:36 coot joined
08:36 <geekosaur> btu only configure the keyboard part (hscurses but stick to the terminfo part, or the low level terminfo bindings)
08:36 <merijn> Answer 1) buy a copy of Advanced Programming in the UNIX Environment and read up on the hell that is ttys, tty modes and lots of confusion about raw, cooked and half-cooked modes
08:36 <Gurkenglas> geekosaur, why not the ncurses package? It was updated more recently
08:36 <merijn> Answer 2) You're writing a terminal UI, use brick/vty-ui and forget all the other mess
08:36 eatman joined
08:36 twanvl joined
08:37 <merijn> Gurkenglas: Because ncurses has a retarded API that drives you insane
08:37 <Aruro> i have vty and terminfo currently installed
08:37 <merijn> Which, incidentally probably also applies to hscurses, being an ncurses binding
08:37 <Gurkenglas> so's ncurses
08:37 <merijn> Aruro: What are you actually trying to implement?
08:38 <merijn> Gurkenglas: Right, but I already said ncurses was a Cthulhian nightmare :)
08:38 <Aruro> taking keystroke up and down from terminal and changing time interval of printing stuff on screen
08:38 <Aruro> simple
08:38 <ahri> ventonegro: hmm i'm doing "events >>= traverse (applyEvent db)" and getting "Couldn't match type ‘Maybe’ with ‘Either Error’" - which is sorta what i expected to be a problem with this. db :: Database, events :: Either Error [Event]
08:38 <Gurkenglas> Was just trying to make sure you didnt confuse ncurses the haskell package with the ncurses that binds to
08:38 <ahri> applyEvent :: Database -> Event -> Maybe Database
08:38 <merijn> Aruro: Yes, but what kinda program? Are you trying to write some terminal UI? If yes, use brick
08:39 _sg joined
08:39 <Aruro> yes, terminal, why not vty? i have no brick :(
08:39 <Gurkenglas> Why not just do getChar for w and s?
08:39 <merijn> Aruro: brick is a high level interface build on vty
08:39 <ventonegro> ahri: well, now you gave your function signature :)
08:39 <merijn> :t (>>=)
08:39 <lambdabot> Monad m => m a -> (a -> m b) -> m b
08:40 <merijn> ahri: Notice, same 'm' on both sides
08:40 mszczygiel joined
08:40 sypwex joined
08:40 <merijn> ahri: 'Either Error' is not 'Maybe', so you can't mix those
08:40 <ventonegro> ahri: my bad
08:40 <ahri> yeah, that's what i expected. i was wondering whether i need to transform the Either to a Maybe or something
08:40 <ahri> but i have no idea whether that's the correct approach
08:41 patbecich joined
08:41 augur joined
08:42 <ahri> this scenario of 2 different monads is not one i've had to deal with yet, but i've been looking forward to it :)
08:43 <merijn> ahri: converting the maybe to either is probably best
08:43 <merijn> "maybe (Left myError) Right . traverse (applyEvent db)" or something
08:47 alexelcu joined
08:47 alexelcu left
08:47 rfmind joined
08:48 alexelcu joined
08:48 <ahri> hm, i see, thanks :)
08:49 <ahri> on the subject of Brick - does it work well cross platform? and would it suit representing a realtime game on the console with it?
08:49 rfmind left
08:51 <merijn> ahri: As long as your definition of "cross platform" does not include Windows, I think it works well
08:51 benl23 joined
08:51 <ahri> merijn: it kinda did, but i'm not all that bothered by windows i guess ;)
08:51 <merijn> ahri: I've actually decided it's probably easier to write a game using brick, dump it on a $5 VPS and tell windows users to use PuTTy to play it then figure out windows portability ;)
08:52 Guest91589 joined
08:52 coot joined
08:52 <geekosaur> windows console is weird for that stuff :/
08:52 mkoenig joined
08:52 <ahri> haha, it supposedly supports bash now, so perhaps in the future...
08:53 <Aruro> why supporting windows?
08:55 <Aruro> not supporting windows willbring more people to normal worlds, instead of half baked solutions which anycase dont work
08:55 <Aruro> nobody in production uses haskell on windows
08:56 <merijn> Aruro: uh...SPJ does all his GHC work on windows
08:56 rcat joined
08:56 <Aruro> wtf? really?
08:56 <merijn> Yes, always has
08:56 redeemed joined
08:56 <jle`> also microsoft is one of the biggest sponsors of haskell development so there's that
08:56 <Aruro> wierd. what does he say? why he does it?
08:57 <jle`> s/sponsors/supporters
08:57 <jle`> but that was probably only because SPJ used to work there, admittedly
08:57 <Aruro> jle`: i thought haskell was academic
08:57 Denthir joined
08:57 <jle`> Aruro: you thought wrong :)
08:58 <merijn> jle`: SPJ still works at MSR
08:58 <int-e> MSR is largely academic.
08:58 <merijn> s/largely//
08:58 gregman_ joined
08:58 oish joined
08:58 <merijn> MSR is more academic than a significant percentage of universities
08:58 afldcr joined
08:59 <Aruro> hence has nothing to do with windows
09:00 <merijn> Purely functional language implementors just like Windows :p
09:00 <merijn> The main platform of Clean is also Windows
09:00 <Aruro> merijn: does spj use emacs on windows? what does he code in?
09:00 hhf joined
09:01 <merijn> No idea, tbh
09:01 <tsahyt> SPJ also uses do notation with {} and ;s
09:01 <Aruro> mmm
09:01 <tsahyt> according to a comment edwardk made on reddit a few days ago iirc
09:02 <tsahyt> I find that a lot stranger than somebody using windows :P
09:02 <Aruro> they are together :D
09:02 <osa1> Aruro: he uses a shell connected to a linux server and runs emacs in it
09:03 <tsahyt> talking about windows, how's the haskell + gtk situation on windows? I think threadscope uses gtk, and I've never heard any complaints about it from windows users
09:03 bjz joined
09:03 sanett joined
09:06 slomo joined
09:07 significance joined
09:08 <tsahyt> the reason why I'm asking is because FRP has made me start to like GUI programming.. which is the strangest thing really
09:09 Faucelme joined
09:10 eacameron joined
09:10 Yuras joined
09:11 Wizek joined
09:11 Wizek_ joined
09:11 ij left
09:11 FreeBirdLjj joined
09:12 alios joined
09:12 haiming joined
09:12 <merijn> tsahyt: I think it's the same as most GUI frameworks and most OSes. Horrible initial pain to setup, but reasonable if you get it working?
09:12 <Aruro> what is the way to get asynchronous keystrokes? getChar solution demands full stop
09:13 <tsahyt> well that's good enough then
09:13 xtreak joined
09:14 <merijn> tsahyt: Be warned, I haven't actually tried it, though ;)
09:14 jgertm joined
09:14 haiming joined
09:14 <tsahyt> merijn: It's good enough to know that it could probably work in principle. as long as I have a choice I have no intentions of supporting windows to begin with.
09:15 <tsahyt> I have no machine to test windows builds on for example
09:15 sypwex joined
09:15 <tsahyt> but it's reassuring to know that a sufficiently determined user could probably make it work
09:15 <Aruro> i was in mediamarkt yesterday, all pcs have windows by default, why people shoul support monopoly?
09:15 jaspervdj joined
09:16 uglyfigurine joined
09:16 <Aruro> its like all cars have diesel
09:16 <Aruro> engine
09:17 zv joined
09:17 <tsahyt> the engine thing depends mostly on where you are in the world. I'll assume you're german because mediamarkt. the americans have barely any diesel engines in their cars
09:18 Kundry_Wag joined
09:18 <merijn> This doesn't strike me as a particularly on-topic or interesting discussion, though?
09:18 <tsahyt> agreed
09:19 <Aruro> people often complain about poor support of something good on windows (haskell)
09:20 <Aruro> as an argument against it.
09:22 mmn80 joined
09:22 Yuras joined
09:23 <Maxdaman1us> against Windows or against Haskell?
09:23 <Aruro> haskell
09:23 fendor joined
09:23 ozgura joined
09:26 oisdk joined
09:26 <Aruro> is forkIO the only way to get asynchronous getChar keystrokes?
09:28 tsmish joined
09:28 balor joined
09:29 meba joined
09:30 <lapinot> me again, is there any (possibly hacky, involving Dynamic or the like) way to get some data out of a GADT that has "eaten" a type variable?
09:31 <merijn> Aruro: What does "asynchronous" mean here?
09:31 <tsahyt> lapinot: pattern matching on it with scoped type variables enabled
09:31 <merijn> lapinot: Can you explain what you mean by that?
09:31 <cocreature> lapinot: could you provide an example? I don’t understand that question
09:31 <tsahyt> unless I misunderstand
09:32 mohsen_ joined
09:33 <lapinot> for example the oblivious type would be `data X = MaybeAConstraintHere a => Foo a -> X` and I would like an unwrap function that could get a value back (I know this sound silly, it is, so what could be workarounds?)
09:34 fadeway__ joined
09:34 <lapinot> I read a bit of the text about "phantom types", that could be some way out, but I don't really see how
09:34 <merijn> lapinot: No, unless you modify X
09:34 akh joined
09:34 <cocreature> if Foo is a GADT you might be able to recover some type info by pattern matching on it
09:34 locallycompact joined
09:35 <merijn> He can only uncover the Constraint on 'a'
09:35 <merijn> Not the type of 'a'
09:35 <merijn> Unless he adds a Typeable constraint
09:35 <merijn> lapinot: But the most common scenario for wanting this is falling into the trap of the existential anti-pattern
09:35 thunderrd_ joined
09:35 <cocreature> merijn: if Foo is a gadt you can totally get the type of "a" at least for some gadts
09:35 <merijn> @where existential-antipattern
09:35 <lambdabot> "Haskell Antipattern: Existential Typeclass" by Luke Palmer at <http://lukepalmer.wordpress.com/2010/01/24/haskell-antipattern-existential-typeclass/>
09:36 <merijn> cocreature: Not unless you add the type variable somewhere
09:36 azahi joined
09:36 <Phyx-> geekosaur: windows console is fine, GHC just doesn't use the API directly which results in weirdness
09:36 KarboniteKream joined
09:37 hurkan joined
09:37 louispan joined
09:37 <lapinot> merijn: actually, i'm doing HOAS stuff so this seems like just a nice(tm) use case ;)
09:38 <cocreature> merijn: here’s what I’m referring to http://lpaste.net/
09:38 <cocreature> eh http://lpaste.net/354136
09:39 <Phyx-> in fact, you can replace "GHC doesn't use native Windows XXX which results in weirdness" with just about anything
09:39 <cocreature> if you have multiple branches you’ll at least get the type in each branch
09:39 fendor joined
09:39 <Phyx-> with the exception being memory management and linker, out of necessity
09:40 <merijn> cocreature: Right, but that only works since Foo can only ever be "Foo Int"
09:40 <merijn> cocreature: You couldn't, for example, stuff "Identity a" in there and achieve the same
09:41 <cocreature> merijn: yeah but if there are multiple possibilities you’ll at least get the type in each branch of your pattern match
09:41 FreeBirdLjj joined
09:42 <merijn> Is there a proper mathy/scientific way of saying "5 number summary"? Or is that the best I can do?
09:42 <tsahyt> wait, what? you can pattern match on the type directly?
09:42 <merijn> tsahyt: No
09:42 <merijn> tsahyt: I think you're misreading it :)
09:42 patbecich joined
09:43 <tsahyt> so, case x of { Foo (x :: A) -> .., Foo (x :: B) -> .. } does not work then
09:43 <cocreature> no you can recover type info by pattern matching on values using GADTs
09:43 <merijn> tsahyt: Well you can't even create a Foo with a type different than Int
09:44 <tsahyt> Oh, no I didn't mean Foo from cocreature's paste
09:44 <tsahyt> just some existential wrapper
09:44 <merijn> You can't match on types in existential wrappers
09:44 deepfire joined
09:45 <tsahyt> okay
09:45 <merijn> GHC doesn't store their type at runtime, so you can't recover them either
09:45 <tsahyt> yes, that's what I was thinking. I was worried there for a moment.
09:45 eschnett joined
09:45 <lapinot> if you want to think with my code in sight: https://ptpb.pw/7uUy
09:47 dawehner joined
09:48 <bollu> what's that paper where they describe writing datatypes out as equations?
09:48 itachi joined
09:48 <bollu> like, [a] becomes x = 1 + ax
09:48 <bollu> which gives you x = 1/(1 - a) = 1 + a + a^2 + … ?
09:49 systadmin joined
09:49 <bollu> merijn: do you remember?
09:49 <merijn> That's algebraic datatypes, but I don't know any references
09:50 <bollu> merijn: ah, damn
09:50 xtreak joined
09:50 <bollu> merijn: specifically, I was looking for like, how differentiation gives you zippers
09:51 <bollu> merijn: it was something like "hole context" or something?
09:51 kyle1320 joined
09:51 <merijn> bollu: Yeah, it sounds vaguely familiar but I don't remember author/title
09:51 <tsahyt> bollu: ∂ for data: differentiating data structures
09:51 <tsahyt> maybe this is what you're looking for
09:51 <bollu> http://strictlypositive.org/diff.pdf found it!
09:52 <bollu> tsahyt: thanks :) That and: the derivative of a data type is its type in one hole context
09:53 <bollu> TIL it is conor Mc Bride who came up with this
09:53 <bollu> does he accept research students? ;)
09:54 <tsahyt> at least related work has been done earlier than that by philippe flajolet iirc
09:54 <tsahyt> I remember a paper from the 80s or so
09:54 <tsahyt> the first time I saw something similar was in a category theory textbook
09:54 <bollu> tsahyt: what? :O
09:55 <bollu> tsahyt: will you be here in an hour or so?
09:55 <tsahyt> no the differentiation
09:55 <tsahyt> not*
09:55 <bollu> tsahyt: oh
09:55 <tsahyt> but writing a type out like that
09:55 <bollu> tsahyt: then?
09:55 <bollu> tsahyt: I see. I would still like a reference, please
09:55 <bollu> tsahyt: a categorical interpretation would be super neat
09:55 <tsahyt> sure, let me see
09:56 <bollu> tsahyt: much appreciates
09:56 <bollu> tsahyt: my laptop may go to sleep, it would be nice if you could @tell me the reference :)
09:56 <bollu> appreciated*
09:56 <tsahyt> R.F.C. Walters, Categories for Computer Science. page 82. There he decomposes a tree like this
09:56 <tsahyt> okay, will do.
09:58 takle joined
09:59 bbcue joined
10:00 <tsahyt> I misremembered. It wasn't Flajolet, it was Joyal.
10:00 <tsahyt> @tell bollu http://www.sciencedirect.com/science/article/pii/0001870881900529
10:00 <lambdabot> Consider it noted.
10:00 <tsahyt> unfortunately in french, so I can't really read it
10:01 takle joined
10:02 eacameron joined
10:03 xPaw1 joined
10:06 eacameron joined
10:06 yellowj joined
10:07 tomboy64 joined
10:08 Rodya_ joined
10:09 xall_ joined
10:12 splanch joined
10:12 np356 joined
10:13 gibransr joined
10:13 sanett joined
10:15 fendor joined
10:16 skeuomorf joined
10:17 CurryWurst joined
10:19 fizruk joined
10:19 Kundry_Wag joined
10:24 silver joined
10:26 fendor joined
10:26 coot joined
10:26 Kundry_Wag joined
10:28 fractalsea joined
10:31 eacameron joined
10:33 henriksod joined
10:34 aarvar joined
10:40 zeroed joined
10:44 patbecich joined
10:46 eschnett joined
10:48 phaji joined
10:50 wlemuel joined
10:53 CurryWurst joined
10:54 Itkovian joined
10:56 bjz_ joined
10:56 systadmin joined
10:57 DataComputist joined
10:58 Voldenet joined
10:58 Voldenet joined
10:58 CurryWurst joined
11:00 CurryWurst joined
11:00 soLucien joined
11:01 stef204 joined
11:03 CurryWurst joined
11:05 splanch joined
11:07 HoierM joined
11:07 AndreasK joined
11:08 xall joined
11:08 MindlessDrone joined
11:09 Rodya_ joined
11:10 <eatman> Hey, tell me, what can be an applicative functor wothout being a monad?
11:10 <merijn> eatman: Const
11:10 <merijn> eatman: As in "data Const k a = Const k"
11:11 <merijn> eatman: In fact, trying to implement Functor, Applicative, and Monad for that is a good exercise :)
11:11 <merijn> eatman: hint: You might need a typeclass constraint to implement a lawful Applicative :)
11:11 <merijn> eatman: Also, ZipList is an Applicative, but not a Monad
11:11 <eatman> merijn: thanks.
11:12 <eatman> Did not know Const yet.
11:12 <merijn> eatman: ZipList being a newtype for list, since list has 2 possible lawful Applicatives, only one of which (the default) has a possible Monad
11:12 <eatman> And, ok for ZipList.
11:12 al-damiri joined
11:13 <eatman> :i Const
11:13 <merijn> > f <$> [a,b,c] <*> [x,y,z] :: [Expr]
11:13 <lambdabot> error:
11:13 <lambdabot> Ambiguous occurrence ‘c’
11:13 <lambdabot> It could refer to either ‘Debug.SimpleReflect.c’,
11:13 <merijn> hmmm
11:13 <merijn> @undefine
11:13 <lambdabot> Undefined.
11:13 <merijn> > f <$> [a,b,c] <*> [x,y,z] :: [Expr]
11:13 <lambdabot> [f a x,f a y,f a z,f b x,f b y,f b z,f c x,f c y,f c z]
11:14 <merijn> > getZipList (f <$> ZipList [a,b,c] <*> ZipList [x,y,z]) :: [Expr]
11:14 <lambdabot> [f a x,f b y,f c z]
11:15 sanett joined
11:15 <eatman> Ok ok...
11:15 <eatman> Never easy to understand...
11:16 <merijn> eatman: The normal applicative is cartesian product (all possible pairs), whereas ZipList is pairwise zip of the lists :)
11:16 Aruro joined
11:17 Swizec joined
11:18 <eatman> Yes, I know that for lists and zipLists, just no easy to get it for every possible data type.
11:18 <eatman> But I guess I'll get used to it.
11:18 <tsahyt> there are also some thing that could be monads but aren't because allowing bind would wreck performance
11:19 <merijn> tsahyt: Like?
11:19 mattyw joined
11:19 <tsahyt> merijn: I remember some examples in FRP
11:19 <tsahyt> either behaviors or events, not sure
11:19 <merijn> tsahyt: Oh, time leaks, yes
11:19 <bollu> merijn: also backtracing parers?
11:20 <bollu> merijn: AFAIK arrows were invented for that purpose, right?
11:20 <bollu> tsahyt: thanks for the link. Though, I can't read french either
11:20 <merijn> bollu: Almost all monadic parsers allow backtracking
11:20 <bollu> merijn: no, I mean
11:20 <bollu> merijn: space leaks
11:20 <merijn> (mega/atto)parsec and trifecta have monad instances and do backtracking
11:22 Denthir joined
11:22 netheranthem joined
11:22 <tsahyt> bollu: when I first read about it in the r.f.c. walters book I was quite amazed at how elegant a way of counting the possible trees it was. Basically a very nifty way to derive the catalan numbers. then I got to the joyal paper and the fun ended there due to the language barrier
11:23 Prutheus joined
11:23 <bollu> tsahyt: ah, I see
11:23 ogrady joined
11:23 <bollu> merijn, tsahyt: is there a way to generalise this to n-hole conexts?
11:24 <bollu> would the double derivative work?
11:24 xtreak_ joined
11:25 <tsahyt> you mean in order to derive zippers?
11:25 <bollu> tsahyt: yes, with "n" contexts though
11:25 <bollu> not just 1 context
11:26 <tsahyt> I don't know, this is all stuff that I've just filed away under "it exists" and didn't get to study properly yet.
11:26 <tsahyt> I just remembered where I had seen it
11:26 jle` joined
11:26 jle` joined
11:26 <bollu> I see
11:26 <bollu> well, thanks for the reference in any case
11:27 <bollu> :)
11:27 CtrC joined
11:27 <tsahyt> you're welcome. for the purely combinatorial aspects, there's also a textbook. analytic combinatorics. I meant to do the coursera course of the same name last winter but somehow it never started
11:27 Kundry_Wag joined
11:27 ogrady_ joined
11:28 <tsahyt> it is (or was?) freely available on the internet
11:28 DataComputist joined
11:29 Lord_of_Life joined
11:30 meba joined
11:31 <tsahyt> bollu: purely by intuition I would say that you'd be looking at the analogue of partial derivatives ∂x∂yT. but I have no idea whether order matters here or not, etc.
11:31 <tsahyt> if those are really well behaved derivatives, it shouldn't.
11:32 <tsahyt> great, now I became interested in it again. too many things to learn, too little time
11:32 <bollu> tsahyt: I will probably blog about this if I find it useful for what I am trying to do :)
11:33 <bollu> tsahyt: so I could link you to that
11:33 <tsahyt> that'd be great, thank you!
11:33 <CtrC> so what are arrows good for?
11:33 systadmin joined
11:33 <tsahyt> CtrC: they're just an alternative way of structuring computations
11:33 <CtrC> well, this alternative has tohave some benefits
11:34 <CtrC> otherwise it is equivalence
11:34 <tsahyt> they are equivalent to monads once you bring ArrowApply into it
11:34 <tsahyt> hence why every monad gives rise to an arrow
11:34 <tsahyt> but when you leave that out they are less powerful than monads
11:35 danza joined
11:35 Lord_of_Life joined
11:35 <tsahyt> which can be desireable sometimes. e.g. arrowized FRP came along partly because it allowed controlling the time leaks that can arise when handing out a monadic interface
11:36 systadmi1 joined
11:36 <tsahyt> while I'm already dropping references today: Lindley, Wadler, and Yallop, “Idioms Are Oblivious, Arrows Are Meticulous, Monads Are Promiscuous.”
11:37 <CtrC> wiki book claims arrows are more general than monads
11:37 <systadmi1> ello
11:37 <merijn> CtrC: tbh, Arrows have mostly fallen out of favour
11:38 <tsahyt> CtrC: more general doesn't mean more powerful
11:38 <merijn> CtrC: It turns out that some other classes capture many of the desirable features of Arrows, leaving them rather unpopular as of late
11:38 <tsahyt> merijn: did Applicatives turn up after Arrows?
11:38 <merijn> CtrC: The relevant classes being Applicative, Category, and Profunctor
11:38 <tsahyt> oh right, Profunctor.
11:38 <tsahyt> I've always thought of these as arrows in disguise though
11:39 bjz joined
11:39 <merijn> tsahyt: Yes
11:39 <merijn> The Arrow paper appears to date to 2000
11:39 <merijn> Applicative was discovered in 2004
11:39 spacedog82 joined
11:40 EmbeddedNoobs joined
11:40 <tsahyt> so many abstractions. meanwhile I'm still amazed just by how many things are monoidal in nature
11:41 <CtrC> no so many abstractions, basically containers and functions
11:41 DataComputist joined
11:41 <CtrC> not*
11:41 <ertes> tsahyt: time leaks were not an API problem… we now have monadic FRP without time leaks
11:42 <ertes> they were a problem with semantics
11:42 sypwex joined
11:43 <merijn> I always find it funny how fundamental Applicative is (even when I just started with Haskell), despite being such a recent discovery
11:43 EmbeddedNoobs left
11:43 cyborg-one joined
11:44 louispan joined
11:44 nomicflux joined
11:44 <bollu> tsahyt: if you differentiate this: data Rose a = Rose a [Rose a]. you wind up with Rose' a = [(Bool, Rose a)]
11:45 <bollu> I have no idea how to interpret this as a "one hole context" for a Rose tree
11:45 <bollu> any ideas? merijn as well
11:45 <tsahyt> ertes: I remember you talking about how >>= allows depending on all former values. I guess that's more of a space leak then though
11:45 <CtrC> bollu: how do u carry diffenetiation on data definitions?
11:45 <bollu> CtrC: there's a paper on it :D
11:45 <CtrC> it can not be differential, there is no limit
11:45 patbecich joined
11:45 <bollu> CtrC: check these blog posts out: http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/
11:45 JeanCarloMachado joined
11:46 <bollu> CtrC: yeah, it's a "formal" notion of differentitaion
11:46 <bollu> CtrC: it's not related to analysis
11:47 sigmundv joined
11:47 eschnett joined
11:47 <ertes> tsahyt: that's only related to trying to implement automaton-based FRP using a monadic interface
11:47 <ertes> but there are other, usually graph-based, implementations that don't have that caveat
11:47 <ertes> e.g. reactive-banana and reflex
11:47 <bollu> hm, I think you can use the bool to tag if it is "above" or "below". I'm not sure
11:48 inad922 joined
11:48 <tsahyt> ertes: you mentioned you were working on an automaton-based implementation that circumvented this problem somehow. how's it going?
11:48 <lyxia> bollu: it is related to analysis
11:48 <bollu> lyxia: how so?
11:48 <bollu> lyxia: there's no continuity or whatever
11:49 <ertes> tsahyt: i've been looking for years, and my conclusion is that it's likely impossible
11:49 <CtrC> bollu: that blog post talks about algebra of data types, no derivatives mentioned
11:49 <lyxia> A combinatorial species is associated with a formal series, and when the corresponding power series converge, operations on real/complex functions reflect operations on combinatorial species
11:49 <bollu> CtrC: go to the second and third blog posts
11:49 <bollu> lyxia: hm, really? that is quite neat
11:50 <bollu> lyxia: I did not know about that, thanks for the pointer
11:50 <tsahyt> ertes: that is disappointing.
11:50 <lyxia> and the presence of singularities in these functions tell you about the asymptotic growth of the series
11:50 <tsahyt> ertes: about the semantics giving rise to the problem, are you talking about conal's original FRP semantics?
11:51 <bollu> lyxia: interesting, it seems the "pointing" operation is similar
11:51 <CtrC> bollu: funny enough, i came across this talk on youtube today.
11:51 <merijn> ertes: The semantics are solved? Any references?
11:51 <bollu> CtrC: the same talk?
11:52 m0rphism joined
11:52 nighty- joined
11:53 jdnavarro joined
11:53 <CtrC> yes, algebra of datatypes
11:54 <CtrC> being insightful idea, seems there is no outcome of it?
11:54 <lyxia> Boltzmann generators are based on this.
11:55 augur joined
11:58 numee joined
11:59 Levex joined
12:00 eklavya joined
12:00 <CtrC> based on algebra of types? in original article i can hardly find any mention of ADT
12:01 eacameron joined
12:03 eschnett joined
12:03 coot joined
12:03 <CtrC> in article they talk about lablled structures from combinatorial theory, perhaps it has some connection to ADT
12:04 <lyxia> They talk about sum/product/fixpoint, which correspond to operations that generate standard ADTs.
12:05 <ertes> tsahyt: pretty much… i don't think there are any time leaks left
12:05 albertid joined
12:05 <ertes> merijn: not to any papers, sorry, but the reflex semantics should not have any time leaks
12:05 riaqn joined
12:05 riaqn joined
12:05 Denthir joined
12:06 <ertes> 'hold' is time-capped, so you can't refer to event occurrences from the past
12:06 <ertes> and there is no way to refer to specific points in time
12:07 nomicflux joined
12:08 locallycompact joined
12:10 Rodya_ joined
12:10 <CtrC> anyone knows what happened to this blog : http://www.twanvl.nl/blog/ ?
12:10 <CtrC> internal server error on every post
12:13 <lyxia> I can see the posts fine.
12:13 np356 joined
12:13 <merijn> Same here
12:14 <CtrC> ty
12:15 j2j joined
12:15 systadmin joined
12:15 spatial joined
12:15 hellofunk joined
12:16 <spatial> Want to know if case instead of if in http://lpaste.net/354138 changes the logic.
12:18 <spatial> How do they flow ?
12:20 <spatial> If x == -1.0 there are 4 conditions inside.
12:21 wxc joined
12:21 <vaibhavsagar> hey, can I add a haskell package to stack's global pkgdb?
12:22 <vaibhavsagar> I realise this isn't what stack is meant for but I have these ihaskell-display modules that I want to be accessible from IHaskell and I can't see a better way to do it
12:23 ziocroc joined
12:24 <Athas> Oh, Accelerate 1.0 is out. Gotta try it.
12:26 eacameron joined
12:28 <spatial> How would one code this lisp in haskell ? http://lpaste.net/354139
12:28 stevenxl joined
12:29 <stevenxl> Hi folks. I am trying to run the command cabal install snap on a VPS. Is that command supposed to take up all my memory?
12:29 Kundry_Wag joined
12:30 darjeeling_ joined
12:30 <liste> stevenxl: how much memory is there?
12:30 eklavya joined
12:31 soLucien joined
12:31 <stevenxl> liste: only about 512mb
12:31 <stevenxl> It's a small VPS.
12:31 Zialus joined
12:33 arpl joined
12:34 <sm> "supposed to" is a bit strong, but yes that's normal
12:34 <stevenxl> Cool.
12:34 <stevenxl> Thanks
12:34 <stevenxl> I'll use a bigger VPS. :-)
12:34 <merijn> stevenxl: Alternatively, you could compile in a local VM and just copy the binary to the VPS
12:35 <sm> third option, fiddle with +RTS -M... flag
12:35 <merijn> stevenxl: GHC is...not known for being considerate about how much RAM it consumes during compilation :)
12:35 <merijn> So I would avoid running it on tiny VPS's
12:35 <sm> and install deps with several commands, not just one
12:36 mada joined
12:37 <Athas> stevenxl: you can also turn off optimisations.
12:37 <Athas> I don't remember the cabal stanza, but I sometimes use 'stack --fast' to compile things on my small VPS.
12:37 <Athas> It will run slowly, of course.
12:37 <Gurkenglas> spatial, why are you porting that reinforcement learning thing from sutton's book to Haskell?
12:39 <spatial> Gurkenglas: I don't know lisp very well. Learning ML using haskell. Why ?
12:39 switte joined
12:39 <spatial> Plan to use Haskell bindings with TensorFlow later.
12:41 chlong joined
12:41 Swizec joined
12:41 <Gurkenglas> Because the Haskell code in the post (to other readers: http://codereview.stackexchange.com/questions/159329/recinforcement-learning-example-chap-1-from-suttons-book ) has poor quality and you said you dont want code quality advice and I'm trying to find a way to combat this madness
12:41 coltfred joined
12:42 <Gurkenglas> If you said something like "the guys in the project I want to add this to know Haskell but not Lisp" I could have said that you want to improve the quality if they aren't to run screaming
12:43 <Gurkenglas> At or from you, I don't know :D
12:43 descender joined
12:44 <spatial> Gurkenglas:Please:-) One follows one's path.Can't learn in a day.
12:44 <Gurkenglas> That's fine, I just want to be allowed to tell you how to improve the quality
12:45 <spatial> Please comment there. That is fine.
12:45 <spatial> RL itself is hard and I do it using haskell as a beginner.
12:45 <Gurkenglas> Start by removing the portions of code that aren't used, like fun, store, retrieve, getrow, getcolumn, boardsize, the gloss stuff
12:46 nbro joined
12:46 <nbro> what’s up dudes?! :D
12:46 <Gurkenglas> Next, replace the names like "magicsquare" and "magicnumber" by something that tells the reader what they do
12:47 patbecich joined
12:47 mojjo joined
12:48 sdothum joined
12:48 arquebus joined
12:50 oish joined
12:50 anton___ joined
12:50 azahi joined
12:50 zargoertzel joined
12:51 <nbro> apparently Haskell was to be called curry, but there was a problem regarding the usage of that name because of copyright issues, if I’m not wrong, but absurdely now we also have a programming language called curry…
12:51 <nbro> whatever
12:52 <Cale> huh?
12:52 <nbro> times have changed
12:52 <Cale> I'm not sure about that story
12:52 <nbro> Cale: I read it somehwere
12:52 <c_wraith> I recall something like it from Being Lazy with Class
12:53 <Taneb> I think I read it in the History of Haskell paper?
12:53 <Cale> They went to Haskell Curry's widow to ask her if she'd be okay with them using the name Haskell.
12:53 <c_wraith> yeah, section 2.4 of Being Lazy With Class says they wanted to call it Curry
12:54 <merijn> Ironically, Haskell Curry never liked the name Haskell :)
12:54 <c_wraith> But apparently the reason they went with Haskell instead was... fear of really bad puns about curry?
12:54 <c_wraith> That's odd
12:54 switte1 joined
12:54 <merijn> At least, that's what his widow said according to Lennart :)
12:54 <c_wraith> http://haskell.cs.yale.edu/wp-content/uploads/2011/02/history.pdf
12:55 <mauke> they should've called it Schönfinkel
12:58 <bollu> Cale: do you know stuff about the derivative of type == one hole context stuff?
12:58 <bollu> too many "stuff"s in that sentence
12:58 <bollu> Cale: I was looking for reading references.
12:59 <bollu> Cale: it looks like there is a connection with the thing you explained to me once: analytic combinatorics?
12:59 buglebudabey joined
12:59 deepfire joined
13:03 <bartavelle> Why doesn't this compile ? http://lpaste.net/354141
13:03 freeside joined
13:03 <bartavelle> error: • Couldn't match type ‘RegType a0’ with ‘RegType a’ Expected type: Register a -> Expr (RegType a) Actual type: Register a0 -> Expr (RegType a0)
13:03 cpennington joined
13:05 <Cale> It wouldn't be clear which type 'a' was
13:05 <bartavelle> ah you mean when I use it with an abstract 'a'
13:05 <Cale> Even with a particular 'a'
13:06 <bartavelle> why wouldn't it be clear with a particular 'a'?
13:06 <Cale> Like, suppose Register X = Int, and RegType X = String
13:06 <bartavelle> AHH
13:06 <Cale> and suppose that Register Y = Int and RegType Y = Double
13:06 <bartavelle> yeah obviously :/
13:07 Itkovian_ joined
13:07 <bartavelle> looks like I just can't write that :(((
13:07 <Cale> You could have it take a Proxy a
13:07 <bartavelle> most regtypes for most a's will be Word32 or Word64
13:08 <bartavelle> ah yeah
13:09 <bartavelle> works, thanks, I didn't realize until now how why the term "injective" was used with type families
13:09 <Cale> Another way would be to have a data family which you'd make a new trivial constructor for with each instance
13:09 significance joined
13:09 <Cale> (which would be like Proxy, but with nicer names maybe)
13:10 <bartavelle> proxy is ok to me
13:10 fizbin joined
13:10 <Cale> like, data family Architecture arch
13:11 <Cale> data instance Architecture X86 = AX86
13:11 bjz joined
13:11 oish joined
13:11 <Cale> and then you'd be able to write something like EReg :: Architecture a -> Register a -> Expr (RegType a)
13:11 <bartavelle> ahh
13:11 <bartavelle> yeah it is indeed nicer
13:12 <bartavelle> (except I'm not gunning for x86 yet :p )
13:12 <c_wraith> going straight to x64? :P
13:12 bodisiw joined
13:12 <bartavelle> I'll start with EBPF :)
13:13 buglebudabey joined
13:14 ThomasLocke joined
13:14 <bartavelle> I'm not sure I'll be able to express all the instruction semantics with a GADT, that is just a PoC
13:16 meba joined
13:16 fuzzy-id joined
13:19 mattyw joined
13:19 Alex____ joined
13:21 uglyfigurine joined
13:22 uglyfigurine joined
13:23 <Alex____> Hello
13:24 cur8or joined
13:25 CurryWurst joined
13:25 forker joined
13:26 sea_wulf joined
13:26 itachi joined
13:27 raichoo joined
13:27 <vaibhavsagar> hi there Alex____
13:27 mizu_no_oto_work joined
13:28 sigrlami_ joined
13:29 Kundry_Wag joined
13:32 <Alex____> I've this problem where I have created a directed acyclic graph (which can have different weights) but when I try to calculate the longest path it just doesn't work :|
13:32 <Alex____> So if anyone would be interested in taking a look I got some source code because I'm stuck
13:35 ChristopherBurg joined
13:37 okra_ joined
13:37 <qmm> geekosaur: thanks for responding. what is the search term needed to find all instances of functor in hackage with hayoo?
13:38 <sea_wulf> Alex____: I don't know how much help I will be, but I would love to take a look and see what can be done.
13:41 harfangk joined
13:41 dominik_ joined
13:41 <okra_> I've been reading Oleg's FBackTrack monad (http://okmij.org/ftp/Haskell/FBackTrack.hs) and had a couple questions, if anyone's familiar with that
13:41 alios joined
13:42 <okra_> firstly, I didn't understand what `Incomplete` was used for (why it couldn't just be a "normal" stream, `Stream a = Nil | Choice a (Stream a)'), so I annotated some stuff with `trace' (http://lpaste.net/354142) but it's not printing things in the way I originally expected
13:43 sigrlami__ joined
13:44 <Alex____> Okay sea_wulf, can I message you private somehow or...?
13:44 <c_wraith> okra_: that trace has to evaluate the entire stream...
13:44 <c_wraith> okra_: did you maybe just want to show the first constructor?
13:44 uncertainty joined
13:45 Xanather joined
13:45 <Taneb> Alex____, most IRC clients have a "/msg [name] [private message]" command
13:45 sigrlami9 joined
13:45 <sea_wulf> Alex____: yea just do /msg nick message and host it on pastebin or something.
13:46 ystael joined
13:46 sigrlami9 joined
13:46 splanch joined
13:47 <dominik_> hi, I'm using the most recent haskell-mode from melpa in emacs
13:48 <dominik_> everything works quite well, except that hlint tells me that it cannot find certain modules
13:48 <okra_> c_wraith: yeah, I suppose I wanted to show the first n constructors
13:48 <dominik_> however, when I then compile the module using haskell-interactive-mode, ghc finds everything
13:48 patbecich joined
13:48 <dominik_> so it seems to be an isolated problem with hlint
13:48 <dominik_> has anyone had a similar issue?
13:48 <Alex____> Hmm, it worked for one message ^^ Now it doesnt say anything
13:50 <c_wraith> okra_: then you're going to have to write a function to only look that far ahead and use it in the trace. :)
13:51 sepp2k joined
13:51 <c_wraith> okra_: I'd be somewhat worried about even that, though. Looking n constructors ahead requires recursive evaluation, which will probably result in recursive tracing, and you're back to an infinite loop.
13:52 beerdrop joined
13:54 buglebudabey joined
13:54 fendor joined
13:54 <orion> okra_ said: "Stream a = Nil | Choice a (Stream a)" -- How is this different from the [] data type?
13:56 nh2 joined
13:56 kyle1320 joined
13:57 buglebudabey joined
13:59 oish joined
13:59 stef204 joined
13:59 <nh2> tomjaguarpawaway: I don't understand what the point of ProductProfunctor is. Reading the docs, it seems like it is simply a data type that is both Applicative and Profunctor. Then, why is there need for an extra class for it, why would using `(Applicative (p a), Profunctor p) => ... p ...` not be enough?
14:00 kyle1320 joined
14:00 burtons joined
14:00 m0rphism1 joined
14:00 albertus1 joined
14:02 robkennedy joined
14:02 <kgadek> I'm tired but Applicative (p a) seems to be related to second param, while the docs of ProductProfunctor mention first param
14:02 arpl left
14:02 <kgadek> but I may say rubbish right now, so be warned
14:02 mda1 joined
14:04 <okra_> orion: i think it would be in the MonadPlus instance -- `Choice a r `mplus` r' = Choice a (r `mplus` r') `
14:04 kyle1320 joined
14:04 kyle1320 joined
14:05 CurryWurst joined
14:05 <parsnip> is `:i Monoid` maybe the closest built-in local thing to lambdabot's `@instances Monoid` ?
14:05 <parsnip> easy to install things like `hoogle` count :)
14:07 <lyxia> nh2: you will need "forall a. Applicative (p a)", which you currently can only write with a hack from the constraints package
14:07 CurryWurst joined
14:07 detrumi joined
14:08 kaiserA joined
14:08 mmachenry joined
14:10 tsmish joined
14:11 significance joined
14:11 tdfirth joined
14:11 henriksod joined
14:11 Rodya_ joined
14:11 <dawehner> Hi. I try to understand why on Monoids the type need to be more explicit than on Functors on Applicatives: https://gist.github.com/dawehner/0f482284225f4a65d53c8f4388fe8bfc
14:11 Swizec joined
14:11 jathan joined
14:11 deepfire joined
14:12 <Taneb> dawehner, short answer: a Monoid is a thing a type can be. A Functor is a thing a type constructor (a function from types to types) can be
14:12 <Taneb> List is a function from types to types, you need to give it a type to get a type
14:13 CurryWurst joined
14:13 np356 joined
14:14 Rodya_ joined
14:16 crobbins joined
14:17 simukis_ joined
14:18 juhp_ joined
14:18 <ocharles> Any of the LambdaCube guys here?
14:19 cmsmcq_ joined
14:21 cmsmcq__ joined
14:21 <nh2> lyxia: thanks
14:22 oisdk joined
14:23 CtrC joined
14:23 edsko joined
14:24 <nbro> what’s the problem with this function: https://pastebin.com/utmPksnA?
14:25 <Cale> nbro: Well, it doesn't handle the case of an empty list
14:25 <Cale> nbro: and it's also really weird
14:26 <Cale> It gives an empty list in the case that the input list is length 1
14:26 <nbro> wait, I got it wrong, indeed, the second guard I wanted to check for the emptiness of the list not xs
14:26 <Cale> The pattern match (x:xs) implies that the list is nonempty
14:26 <nbro> in that case I may want to use s@(x:xs)
14:26 <Cale> That pattern still won't match an empty list
14:26 <Cale> You want to add another case above this one, like takeInt a [] = ...
14:27 <nbro> why wouldn’t it match the empty list?
14:27 <Cale> If you made the pattern s@(x:xs), then null s would simply always be False
14:27 Yuras joined
14:27 <Cale> Because (x:xs) is a list which starts with the element x, and whose tail is xs
14:27 <Cale> Such a list can't be empty, because it contains the element x
14:28 <Sornaensis> (:) is a list constructor
14:28 <Sornaensis> :t (:)
14:28 <lambdabot> a -> [a] -> [a]
14:28 sword865 joined
14:28 eacameron joined
14:28 <Sornaensis> works like any other constructor in a pattern match
14:28 <nbro> ok
14:29 <nbro> right
14:29 <CtrC> list continuator :) takes [a]
14:29 CurryWurst joined
14:30 <Taneb> CtrC, I've never heard that term used like that before
14:30 <nbro> anyway, this gives me a parse error: https://pastebin.com/xCXS2Kct
14:30 <CtrC> function which takes [a] obviously does not make list :)
14:30 Kundry_Wag joined
14:30 <nbro> Cale: i.e. if I simply handle the case you mentioned
14:31 <Taneb> CtrC, what about let x = 1:x in x?
14:31 <Taneb> x is an entirely new list there
14:31 <nbro> opps
14:31 <nbro> sorry
14:31 WarmCookie joined
14:31 carlomagno joined
14:31 deepfire joined
14:31 <nbro> switching between programming languages from day to day, this is the result
14:31 <Sornaensis> > let x = 1:x in x
14:31 <lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
14:31 <Cale> Yeah, the x:xs needs to be in parens there
14:32 <nbro> yeah
14:32 <nbro> ;)
14:32 <Sornaensis> > let x = 1:y; y = 0:x in x
14:32 <lambdabot> [1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0...
14:32 <Cale> > let evens = 0 : map (+1) odds; odds = map (+1) evens in evens
14:32 <lambdabot> [0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52...
14:32 spacedog82 joined
14:33 <Sornaensis> lol
14:33 sanett joined
14:33 <Cale> > let primes = 2 : filter isPrime [3,5..]; isPrime n = all (\p -> n `mod` p /= 0) (takeWhile (\p -> p*p <= n) primes) in primes
14:33 <lambdabot> [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,...
14:33 <CtrC> infinite lists are best friends to start talking about lists, sure :)
14:33 beckyconning joined
14:33 <CtrC> :t (:)
14:33 <lambdabot> a -> [a] -> [a]
14:35 <CtrC> :t Just
14:35 <lambdabot> a -> Maybe a
14:35 Itkovian joined
14:35 <CtrC> pretty clear who is constructor and who is not.
14:35 <WarmCookie> :t pure @Maybe
14:36 <lambdabot> error:
14:36 <lambdabot> Pattern syntax in expression context: pure@Maybe
14:36 <lambdabot> Did you mean to enable TypeApplications?
14:38 hackebeilchen joined
14:39 Rodya_ joined
14:39 <CtrC> :t pure 5
14:39 <lambdabot> (Num a, Applicative f) => f a
14:39 NickHu joined
14:40 dawehner joined
14:40 fractalsea joined
14:42 Boomerang joined
14:42 JagaJaga joined
14:42 <CtrC> :t pure
14:42 <lambdabot> Applicative f => a -> f a
14:43 <CtrC> this looks like list constructor.
14:43 <c_wraith> > pure 5 :: [Int]
14:43 <lambdabot> [5]
14:43 <c_wraith> It creates singleton lists, sure. But it does a lot more, too.
14:43 <Taneb> CtrC, yet that is implemented in terms of (:) and []
14:43 <WarmCookie> CtrC: It's a more general version, provided by Applicatives.
14:43 <Taneb> pure x = x : []
14:44 <CtrC> [] is list on its own :)
14:44 <dawehner> Taneb: interesting, I think I get it
14:44 sanett joined
14:44 <CtrC> :t [[]]
14:44 <lambdabot> [[t]]
14:45 mugi_ joined
14:45 sanett joined
14:46 <qmm> this seems like a hack: https://sidburn.github.io/blog/2016/03/24/higher-kinded-polymorphism
14:47 <qmm> wouldn't you want your language to just give you this functionality?
14:47 WhiskyRyan joined
14:47 <Sornaensis> F# doesn't have polymorphic functions?
14:48 ludat joined
14:48 wtetzner joined
14:48 <c_wraith> F# doesn't have anything like type classes.
14:48 <Sornaensis> you can do that in Rust with traits
14:48 <c_wraith> It also doesn't have abstraction over higher-kinded types.
14:48 <Sornaensis> I wish they'd add higher kinded types to rust already
14:49 <qmm> i suppose you could start building your own library that has functors, applicatives, monoids, monads, comonads (um, are these called higher kinds?) and try pushing this library as best practice to other developers
14:49 balor joined
14:49 marsam joined
14:50 <qmm> there's a great chance that you'll use a library that doesn't use your library though and then how do you extend their work support your style?...
14:50 <Sornaensis> for what language
14:50 Jesin joined
14:50 mugi_ left
14:50 <c_wraith> this F# article is weird. It claims to talk about higher-kinded polymorphism, but all the examples are about type classes.
14:50 <qmm> any language like fsharp that doesn't have "abstraction over higher kinded types"
14:50 <Sornaensis> you need hkts to implement functors and monads in a statically typed language
14:51 <dolio> Yeah, I don't see any higher kind stuff there.
14:51 <qmm> c_wraith: i guess "abstraction over higher kinded types" is called higher kinded polymorphism
14:51 <Sornaensis> otherwise you end up with abstractions that don't actually work
14:51 systadmin joined
14:52 <qmm> an example of higher kinded types are [a], correct?
14:52 <c_wraith> No
14:52 <Sornaensis> @kind []
14:52 <qmm> s/are/is
14:52 <lambdabot> * -> *
14:52 <c_wraith> [] is higher-kinded. [a] is not
14:52 <Sornaensis> @kind [a]
14:52 <lambdabot> error: Not in scope: type variable ‘a’
14:52 <Sornaensis> @kind [Int]
14:52 <lambdabot> *
14:52 <balor> I often end up with `data Manufacturer = HONDA | DUCATI` and then `data Bike = Bike {manufacturer:: Manufacturer}` types in my applications. How do I `toJson` Manufacturer to a value? I've tried `toJSON HONDA = value "honda"` But I'm unconvinced this is the right approach.
14:52 robotroll joined
14:53 <qmm> alright, [] / List is higher kinded
14:53 <brynedwards> instance ToJSON?
14:53 <Sornaensis> higher kinded types are like type functions
14:53 <Sornaensis> @kind StateT
14:53 <lambdabot> * -> (* -> *) -> * -> *
14:53 <balor> brynedwards, Does it make sense to have Manufacturer as an instance of ToJSON that returns a value rather than an object?
14:53 <Sornaensis> they take other types to make 'concrete' types
14:54 <dolio> qmm: c_wraith's point is that the 'novel' thing in that article is constrainted polymorphism, not higher kinds.
14:54 <Sornaensis> you need this to properly implement functors, because functors represent function objects that wrap some contained type-- where the contained type may change with fmap
14:54 <dolio> All the variables are still kind * in the article.
14:54 Sh4rPEYE joined
14:55 <qmm> but then a functor is a single level of abstraction higher than []?
14:55 <Sornaensis> functor is a type class
14:55 <dolio> Just instead of 'forall a' they have 'forall a with (+) member'.
14:55 <brynedwards> balor: I would. You'd end up with something like '{ "bike": { "manufacturer": "honda": } }'
14:55 <Sornaensis> so yea, many types can implement it like you might implement an abstract class in OOP
14:56 <Cale> Sornaensis: function objects?
14:56 <Cale> what
14:56 <Sornaensis> eh yea in the mathematical sense
14:56 <c_wraith> qmm: [] is a concrete type. Functor requires the ability to abstract over *any* type of kind * -> *
14:57 <brynedwards> balor: The beginning of the Aeson docs show to generate generic ToJSON instances, see https://hackage.haskell.org/package/aeson-1.1.0.0/docs/Data-Aeson.html
14:57 coltfred joined
14:57 <Cale> In the mathematical sense, they consist of a function from objects (of a category) to objects (of another), as well as a corresponding function from arrows to arrows
14:57 <balor> brynedwards, thanks
14:58 mmhat joined
14:58 earldouglas joined
14:58 <Cale> Of course, in the case of Haskell, both the categories are going to be the category whose objects are Haskell types, and whose arrows are functions
14:58 oish joined
14:59 <Cale> The type-level function f is then the mapping on objects, sending Haskell types to Haskell types
14:59 moth joined
14:59 <Cale> and then fmap :: (a -> b) -> (f a -> f b) is the mapping on arrows
14:59 <Sornaensis> ah
15:00 <WarmCookie> Cale: Is `arrow` just another term for `morphism` ?
15:01 _sg joined
15:01 <bollu> WarmCookie: I think Cale means "arrow" in the category-theoretic sense
15:01 <WarmCookie> Cale: Or do morphisms translate differently in Haskell?
15:01 <c_wraith> iirc, arrows are more generic
15:01 <c_wraith> and yes, Cale's description was category theory arrows.
15:02 <WarmCookie> I see. When I hear arrow I think (->) of Hask.
15:02 <dolio> They're just two different names for the same thing.
15:02 <Cale> Well, people use the word "morphism" as a synonym for the category theoretical notion of "arrow" too.
15:02 <Cale> yeah
15:02 <Sornaensis> when you say arrow you mean (->)
15:02 <Sornaensis> ?
15:03 wraithm_ joined
15:03 <Cale> Well, in this context, I mean the more general thing -- arrows are part of the data you specify when you define a category.
15:03 erisco joined
15:03 <Sornaensis> ah
15:03 <Cale> In the case of Haskell, the arrows are (all) functions
15:03 <c_wraith> in the category of haskell types, arrows correspond to functions.
15:04 <Sornaensis> what is the Arrow typeclass based on
15:04 <c_wraith> That's something entirely different
15:04 <c_wraith> Hughes Arrows, I believe
15:04 <CtrC> talk about smart names.
15:04 Luke_ joined
15:04 <Cale> Yeah, sadly, the Arrow type class doesn't quite line up with pre-existing terminology
15:05 <bollu> Cale: doesn't "Machine" make more sense for it?
15:05 <bollu> Cale: at least, that is the interpretation that made most sense to me
15:05 <Cale> "Machine" could mean a whole lot of stuff
15:05 <erisco> like ramps and pulleys and stuff
15:05 <Sornaensis> make more sense for what
15:05 <Cale> When you're naming abstractions, lots of words could do just as well, you just need a consistent tag
15:06 <CtrC> erisco: all machines are the same. u justs did not notice.
15:06 <bollu> Cale: also, what was the book you had given me for combinatorics? It was like, studying combinatorics with algebra
15:06 <bollu> Cale: you told me of the reference when I asked about the "fractional cardinality" stuff
15:06 Mon_Ouie joined
15:06 <bollu> Cale: defining the size based on the Aut of an object
15:06 vtomole joined
15:06 tomku joined
15:06 <Cale> When F is a Hughes Arrow, the values of type F a b can be seen as arrows in a monoidal category between objects corresponding to a and b.
15:07 DataComputist joined
15:07 <Cale> and I believe that's the inspiration for it
15:07 sleffy joined
15:07 descender joined
15:08 <qmm> Cale: your explanation via category theory is much appreciated
15:08 <Cale> It's not *just* monoidal categories though, they're particular special sorts of monoidal categories, having the collection of Haskell types as their objects, and with some special relationship to the category of Haskell types and functions, and a bunch of other stuff.
15:08 ickabob joined
15:09 <CtrC> reading cathegory theory stuff is like calculating WHNF in your brain
15:09 Argue joined
15:09 <erisco> that's what we do as programmers all the time oO
15:09 m0rphism2 joined
15:10 osa1 joined
15:10 osa1 joined
15:11 significance joined
15:11 Lord_of_Life joined
15:12 xall joined
15:12 vtomole joined
15:12 np356 joined
15:13 mt joined
15:14 splanch joined
15:15 markasoftware joined
15:15 patbecich joined
15:16 <markasoftware> is there any more haskelly way to do this?
15:16 <markasoftware> revOtherWords boop = unwords $ map (\(i, w) -> if mod i 2 == 1 then reverse w else w) $ zip [0..] $ words boop
15:16 <markasoftware> to reverse every other word from input
15:16 Xanather_ joined
15:16 KelvinHiew joined
15:16 Amadiro joined
15:17 meba joined
15:17 Fairy joined
15:17 <cocreature> markasoftware: you could consider using zipWith instead of map & zip but it looks like a pretty reasonable solution
15:17 <c_wraith> markasoftware: using zipWith and cycle let you simplify a bit.
15:18 <markasoftware> oh cool, ill try it with zipwith
15:18 <c_wraith> zipWith (\c w -> if c then reverse w else w) (cycle [False, True]) ...
15:18 <erisco> > zipWith ($) (cycle [id, reverse]) . words $ "Greetings from the citizens of Earth!"
15:18 <lambdabot> ["Greetings","morf","the","snezitic","of","!htraE"]
15:18 <c_wraith> oh, that's better.
15:18 <markasoftware> oh coocle, didn't know the cycle function
15:18 <c_wraith> if is kind of awful
15:18 <c_wraith> cycle over id and reverse is much better
15:19 <markasoftware> wow cycling over functions, i wouldn't have thought of that one
15:19 <cocreature> oh yeah cycle [id, reverse] is nice!
15:19 sanett joined
15:19 <ski> > (unwords . concat . map (\ws -> case ws of [w0,w1] -> [w0,reverse w1]; _ -> ws) . chunksOf 2 . words) "The quick brown fox jumps over the lazy dog" -- markasoftware ?
15:19 <lambdabot> "The kciuq brown xof jumps revo the yzal dog"
15:19 <bollu> hahaha, cycling over the functions is so cool
15:19 ragepanda joined
15:20 Fendor joined
15:20 sanett joined
15:20 <ski> the `cycle' one is nice, yes
15:20 <c_wraith> though..
15:20 <nbro> is there a way to simplify this function: https://pastebin.com/NMppjbnY?
15:20 <c_wraith> Instead of zipWith ($), you could use zipWith id
15:21 <c_wraith> one character shorter and draws more double-takes!
15:21 <* ski> would use `($)' in this case
15:21 <cocreature> yeah I think ($) makes the intention clearer
15:21 nick_h joined
15:21 sanett joined
15:22 ljhms joined
15:22 boombanana joined
15:23 <markasoftware> well thanks guys
15:23 <WarmCookie> nbro: I'd either remove the `length` guard or move it elsewhere so that it gets memoized.
15:24 <WarmCookie> Each recursive call to dropInt is going to do a complete traversal currently (quadratic).
15:24 <Fendor> nbro, the length guard is not neccessary at all imo
15:24 zzq joined
15:25 <erisco> is this intended as a reimplementation of drop?
15:25 dan_f joined
15:26 <ski> > (onWords . perChunksOf 2) (\ws -> case ws of [w0,w1] -> [w0,reverse w1]; _ -> ws) "The quick brown fox jumps over the lazy dog"
15:26 <lambdabot> "The kciuq brown xof jumps revo the yzal dog"
15:26 KelvinHiew joined
15:27 kaiserA joined
15:27 <Fendor> :t onWords
15:27 <lambdabot> ([String] -> [String]) -> String -> String
15:28 <nbro> erisco: yes, but for list of integers…
15:28 <Fendor> :t (onWords . perChunksOf 2)
15:28 <lambdabot> ([String] -> [String]) -> String -> String
15:28 <Fendor> sorry, will talk to lambdabot in private
15:28 <erisco> nbro, sorry I don't understand what you mean. dropInt and drop have the same type
15:29 <nbro> yeah, it’s intended as a re-implementation of drop
15:29 <qmm> how can you use hayoo to query for all instances of the functor instance?
15:29 <erisco> well, you can look at the official implementation to compare
15:30 davama joined
15:30 davama left
15:30 <nbro> erisco: the idea is that you could give me some feedback on your practices
15:31 <nbro> but what you’re suggesting is also a good thing
15:31 mmachenry joined
15:31 <ski> Fendor : `onWords f = unwords . f . words; perWord = onWords . map; onChunksOf n f = concat . f . chunksOf n; perChunksOf n = onChunksOf n . map'
15:31 RGamma joined
15:32 bbcue joined
15:32 <Fendor> ski, these are interesting functions
15:32 <Fendor> ski, i've never seen them before ^^
15:32 raycoll joined
15:32 <ski> one can easily define `onLines f = unlines . f . lines; perLine = onLines . map', &c.
15:32 <ski> see
15:32 <ski> @where TV
15:32 <lambdabot> http://www.haskell.org/haskellwiki/TV
15:33 <ski> (the end)
15:33 <ski> also
15:33 <ski> @where SEC
15:33 <lambdabot> http://conal.net/blog/posts/semantic-editor-combinators/
15:34 nick_h joined
15:35 <Fendor> ski, thanks for the links
15:35 MindlessDrone joined
15:38 <Fendor> small question, is there a language extension to access a field in the same way you can do it in elm?
15:39 <Fendor> for example
15:39 <Fendor> > data T = T {a :: Int, b :: Int}
15:39 <lambdabot> <hint>:1:1: error: parse error on input ‘data’
15:39 eschnett joined
15:39 <Fendor> dammit, can't use lambdabot properly...
15:40 <Fendor> @let data T = T {a :: Int, b :: Int}
15:40 <lambdabot> .L.hs:170:1: error:
15:40 <lambdabot> Multiple declarations of ‘T’
15:40 <lambdabot> Declared at: .L.hs:168:1
15:40 urodna joined
15:40 <Fendor> @let data Example = E {a :: Int, b :: Int}
15:40 <lambdabot> .L.hs:170:18: error:
15:40 <lambdabot> Multiple declarations of ‘a’
15:40 <lambdabot> Declared at: .L.hs:168:12
15:41 <Fendor> @let data Example = E {a' :: Int, b' :: Int}
15:41 <lambdabot> Defined.
15:41 <Fendor> @let example' = E {a' = 4, b = 5}
15:41 <lambdabot> .L.hs:171:22: error:
15:41 <lambdabot> Ambiguous occurrence ‘b’
15:41 <lambdabot> It could refer to either ‘Debug.SimpleReflect.b’,
15:41 <Fendor> @let example' = E {a' = 4, b' = 5}
15:41 <lambdabot> Defined.
15:41 <Fendor> and now access b' like example'.b'
15:41 Lord_of_Life joined
15:41 <ski> > b' example'
15:42 <lambdabot> 5
15:42 sanett_ joined
15:42 Swizec joined
15:42 robotroll joined
15:42 <Fendor> ski, yes, but is there a language extension that lets me use it the other way round?
15:43 <Fendor> i feel, that it is more readable than `b' example'`
15:43 <ski> > example' & b'
15:43 <lambdabot> 5
15:43 <Fendor> :t (&)
15:43 <lambdabot> a -> (a -> b) -> b
15:43 <Fendor> where is that operator defined?
15:43 <* ski> 'd prefer something like the SML syntax, where it'd be : #b' example'
15:43 alexelcu joined
15:43 <ski> @index (&)
15:43 <lambdabot> Data.Function
15:44 <Fendor> thank you a lot
15:44 <* ski> wouldn't use `&', personally
15:44 raichoo joined
15:45 <Fendor> mhm, for most people, it would be unexpected, wouldn't it?
15:45 <ski> what would be unexpected ?
15:46 <Fendor> to use this operator, because most people probably dont use it
15:46 <Fendor> ?
15:46 jao joined
15:46 <monochrom> So let's use it more so more people will use it.
15:46 <ski> i don't think that's a that important criterion when deciding whether to use it
15:47 <Fendor> ok, so why wouldnt you use it?
15:47 <glguy> Most of the time people won't need any operator at all to apply a function to its argument
15:47 csaurus joined
15:47 mceier joined
15:47 <ski> what glguy said
15:48 <ski> however, i do think it's a design mistake in Haskell to use the same notation for the field as for the field accessor function
15:49 <erisco> lol, was wondering why my program was so awfully slow
15:49 Argue_ joined
15:49 <erisco> turns out I had a really slow debug line in it and just forgot
15:49 <Fendor> it's not like i need it, but if I have a nested datastructure, id need to destructe it to get a specific value. If i use it like accessor function, personally i feel like it is harder to read
15:49 <ski> whether you write `#x point' or `point .x' is less important. but if `x' is a field of type `Int', then it's confusing that in `x point', `x' now suddenly has type `Point -> Int'
15:49 <markasoftware> when would one want to use FastCGI with yesod rather than Warp?
15:50 <ski> (especially as in `MkPoint {x = 42,...}', `x', and `42', has type `Int')
15:50 eklavya joined
15:51 fractalsea joined
15:51 <erisco> I am just annoyed by the collision
15:51 <ski> Fendor : anyway, i also think that many people use `$' way too much ..
15:51 <Fendor> ski, yes, i think, thats exactly what my problem is
15:52 <Fendor> ski, really? i thought it was good style to use as few parenthesis as possible
15:52 <glguy> Fendor: not particularly
15:52 <ski> there's nothing wrong with brackets
15:52 <erisco> I like using parentheses
15:52 <monochrom> I attribute it to programmers choosing to be programmers because they hate math.
15:52 <Fendor> yeah, sometimes me too, except for nested brackets
15:53 grillon joined
15:53 azahi joined
15:53 <ski> something it's nicer to write `(foo . bar x y . baz z) (...)', though. i wouldn't write `foo $ bar x y $ baz z $ ...'
15:53 <erisco> I actually changed to rarely using $
15:53 <erisco> I just use it, from what I can recall, unapplied or as foo $ \x -> ...
15:53 <Fendor> well, yes, totally agree on that example, i never use more $'s than one
15:53 <Fendor> in one expression
15:54 <erisco> because you can have something like foo $ \x -> bar $ \y -> ...
15:54 <ski> basically, i mostly use `$' when it's followed by a lambda, or a keyword (`do',`let',`case',`if') .. imho, it would be nicer to change the parsing rules so that a `$' wouldn't be needed here. then most of my uses of `$' would be gone
15:54 <erisco> makes a particular formatting convenient
15:54 <MitchellSalad> I would write `(foo . bar x y . baz z) (...)` as `foo (bar x y (baz z ...))`
15:54 eacameron joined
15:54 <ski> MitchellSalad : it depends, but yes, that can also be nice
15:55 <erisco> the former is SEC style
15:55 <MitchellSalad> if you can't eta reduce, the former is obfuscatory
15:55 <monochrom> In math, (x + y) * (sqrt z - t) is a perfectly readable expression. But no, programmers hate math and call it unreadable, they have to write multiply $ (add $ x $ y) $ (minus $ (sqrt $ z) $ t), and that's their idea of readable.
15:55 <ski> SEC is rather `(foo . bar x y . baz z) (...) (...)'
15:56 igeaod joined
15:56 robertkennedy joined
15:56 sophiag joined
15:57 <robertkennedy> How can I program ghc/ghci to open a page in chrome?
15:57 <Fendor> ok, to sum up my initial question, there is no way to use an accessor function in the same way elm does and it would be recommended to use (&) as a replacement?
15:58 Bunny351 joined
15:58 <glguy> It would be recommended to get used to using the field accessors in prefix position, otherwise you can use &
15:58 <Fendor> *it would not be
15:58 <robertkennedy> Or the default browser
15:58 <Fendor> glguy, i was used to it, then i tried elm and now i'm thinking that it is easier to read ^^
15:59 <Fendor> robertkennedy, maybe this would work for you? https://hackage.haskell.org/package/open-browser
15:59 Bunny351 joined
16:00 <robertkennedy> Ty I'll check it out
16:00 <Fendor> robertkennedy, it's only one function, i guess, it wont take you long to see if it works for you
16:00 osa1_ joined
16:02 RGamma joined
16:02 trism joined
16:03 Sonolin joined
16:04 earldouglas joined
16:04 Bunny351 left
16:05 revprez_ joined
16:05 mmachenry joined
16:05 dsh joined
16:05 mohsen_ joined
16:09 theelous3 joined
16:09 <ertes> robertkennedy: you can invoke shell commands in GHCi via :!
16:09 armyriad joined
16:11 enitiz joined
16:12 significance joined
16:13 sleffy joined
16:16 michbad joined
16:17 patbecich joined
16:19 spoonm joined
16:19 Noldorin joined
16:20 KarboniteKream joined
16:22 locallycompact joined
16:22 moth joined
16:24 doomlord joined
16:24 isaac_ joined
16:25 spoonm joined
16:25 Rainb joined
16:25 xall joined
16:26 wildlander joined
16:27 <unclechu> hey guys, any ideas why i can't connect as client to DBus in Haskell on FreeBSD? here is minimal example that reproduces it https://pastebin.com/ejruLmKi
16:27 <unclechu> and here is error i get: `SocketError {socketErrorMessage = "Authentication failed", socketErrorFatal = True, socketErrorAddress = Just (Address "unix:guid=53252465d2726f11957f8b9d58de79ab,path=/tmp/dbus-jUIv1mTBAV")}`
16:28 fractalsea joined
16:28 mac10688 joined
16:28 <unclechu> also I start session dbus daemon in `~/.profile`: `DBUS_SESSION_BUS_ADDRESS=`dbus-daemon --fork --session --print-address``
16:30 biglama joined
16:30 <unclechu> i can call `dbus-send` well https://pastebin.com/Ey9d52NK
16:31 <erisco> how might I find the nth root of an integer
16:31 <unclechu> it happens only on FreeBSD
16:31 afnizarnur joined
16:32 RegEchse joined
16:36 <ReinH> erisco: does \n -> (** (1/n)) suffice?
16:36 <erisco> :t (**)
16:36 <lambdabot> Floating a => a -> a -> a
16:36 <erisco> no
16:36 <ReinH> convert the integer to a Double?
16:36 <erisco> that overflows
16:37 <ReinH> To some other Floating member that doesn't overflow?
16:37 Fairy joined
16:37 <erisco> well it might be in range, I'll have to check how large the exponent is allowed
16:38 <ReinH> anyway, the easiest way to find an nth root is to exponentiate by the reciprocal of n
16:38 <ReinH> ofc that won't find all roots
16:39 IanKelling joined
16:39 animated joined
16:39 Micamo joined
16:40 zcourts joined
16:41 <erisco> yeah I think it'll keep enough precision
16:41 <erisco> thankfully I don't need a precise answer
16:42 edvorg joined
16:42 infandum joined
16:42 cmsmcq_ joined
16:42 <infandum> I think there's a bug in https://wiki.haskell.org/GHC/Memory_Footprint
16:42 <infandum> Should IntMap be (3N + 5(N-1) words) + N * sizeof(v)
16:42 <infandum> Right now it's just (3N + 5(N-1) words) + sizeof(v)
16:43 mmn80 joined
16:43 ludat joined
16:44 hybrid joined
16:44 systemfault joined
16:44 tathougies joined
16:46 eugenez joined
16:47 dan_f joined
16:47 <eugenez> Hello friends! Let's say I have a = "10" and b = "1" how do I get ["11", "01"] ? I know list comprehension works, but seems a bit unwieldy
16:48 <eugenez> all combinations if what I'm looking for
16:48 <ski> > [[x,y] | x <- "10",y <- "1"] -- ?
16:48 <lambdabot> ["11","01"]
16:48 <ski> > sequence ["10","1"]
16:48 <lambdabot> ["11","01"]
16:48 <erisco> beat me to it D:
16:49 <eugenez> Yeah, like I said, list comprehesion works, but what if I have unspecified number of inputs?
16:49 <* ski> waits
16:49 cpup joined
16:50 replay joined
16:50 <eschnett> eugenez: what output do you expect if you have a=“12” and b=“3”?
16:51 dmwit joined
16:51 <eugenez> ["13", "23"]
16:51 <ski> > ["13","23"]
16:51 <lambdabot> ["13","23"]
16:51 fotonzade joined
16:52 <eugenez> Cartesian product I believe it is called?
16:52 itachi joined
16:52 <erisco> yes
16:53 <* ski> . o O ( `sequence :: Vec m (Vec n a) -> Vec (Vec m n) (Vec m a)' )
16:53 significance joined
16:53 bollu joined
16:54 Denthir joined
16:54 <erisco> huh?
16:55 buglebudabey joined
16:56 afnizarnur joined
16:57 <ski> (replace `Vec m n' by `Vec m (Fin n)', if you insist)
16:57 argent0 joined
16:57 <erisco> :k Vec
16:57 <lambdabot> error:
16:57 <lambdabot> Not in scope: type constructor or class ‘Vec’
16:57 <lambdabot> Perhaps you meant ‘Rec’ (imported from Lambdabot.Plugin.Haskell.Eval.Trusted)
16:58 <ski> Vec :: Nat -> * -> *
16:58 <erisco> hm, not in scope... but I don't see why it isn't Vec n (Vec m a)
16:58 inad922 joined
16:58 albertus1 joined
16:58 <ski> how many elements would `sequence ["ab","cd","ef"]' have ?
16:59 <eugenez> Wow! Yep, looks like sequence is what I was looking for!!
16:59 <erisco> I am just following the types
16:59 <eugenez> Thank you very much!
16:59 KarboniteKream joined
17:00 <ski> eugenez : cheers :)
17:00 oberstein joined
17:01 <ertes> ski: your thought bubble has a kind error =)
17:03 <ski> ertes : yes (more than one), it's supposed to give an idea :)
17:04 <erisco> Vec m (Vec n a) -> Vec (n ^ m) (Vec m a) where n ^ 0 = 0
17:04 <ski> yes
17:05 <erisco> I don't understand Vec m (Vec n a) -> Vec (Vec m n) (Vec m a)
17:05 stevenxl joined
17:05 <ertes> that doesn't sound right… it doesn't even fit the type of 'sequence'
17:05 <ertes> > sequence ["ab", "cd", "ef"] -- gives two lists of 3
17:05 <lambdabot> ["ace","acf","ade","adf","bce","bcf","bde","bdf"]
17:05 <ertes> oh, no
17:05 <erisco> I know, I said that, but if we wanted to write the n-ary Cartesian product for Vec this is the type we're looking for
17:06 <ski> those elements are indexed by vectors of the shape `[i0,i1,i2]', where `i0',`i1',`i2' are elements of `Fin 2'
17:06 <ertes> yeah, 'sequence' doesn't work
17:07 <ertes> at least not the one from Traversable
17:07 <ski> the idea is to keep the behaviour of `sequence', not the type
17:07 <ski> (and i wasn't that clearly distinguishing between natural numbers and finite types)
17:08 <ertes> a size-indexed version of Traversable could do it, along with a kind-level equivalent of Num
17:08 <erisco> ski, how do I also think about the kind change to Vec you've made?
17:09 <ski> hm, which kind change ?
17:09 <erisco> and why a vector of Fin n at all?
17:09 <erisco> you wrote Vec (Vec m n) (Vec m a)
17:09 <erisco> or maybe changed that to Vec (Vec m (Fin n)) (Vec m a)
17:09 <ski> well, if `n' is a `Nat', then `Vec m n' is a kind-error, but `Fin :: Nat -> *', so `Vec m (Fin n)' isn't
17:10 <erisco> Vec m (Fin n) is not a Nat
17:10 <ski> however, `Vec (Vec m (Fin n)) a' is still a kind error, so `Vec (n ^ m) a' is better still
17:10 stevenxl joined
17:10 <ski> (or we could just say `Vec :: * -> * -> *; Vec n a = n -> a')
17:10 gienah_ joined
17:10 gienah_ joined
17:12 <ski> the point was to ponder this way of typing a version of `sequence', and think about things it might remind one of
17:13 zdenal joined
17:15 twanvl joined
17:16 agjacome joined
17:17 meba joined
17:19 <erisco> what is the point of duplicate record fields if it won't disambiguate the fields for you, ugh
17:19 Swizec joined
17:19 connrs joined
17:19 jud joined
17:19 Croniamental joined
17:20 Kreest__ joined
17:20 <erisco> it does not even disambiguate with field puns
17:20 patbecich joined
17:23 Swizec_ joined
17:25 Luke joined
17:25 <geekosaur> it's a first step
17:25 <* geekosaur> is just waiting for full OverloadedRecordFields
17:26 <cocreature> will OverloadedRecordFields make it into 8.2?
17:26 <cocreature> I’ve lost track of its status
17:27 <geekosaur> IIRC more of the stuff needed for it will, but the full ORF is not there yet
17:28 <geekosaur> oh, huh, updated status page says full ORF *is* making it
17:28 <geekosaur> wait, no, looking more closely, still not the full extension, just more of the changes needed for it
17:28 <geekosaur> ah well
17:28 <geekosaur> "soon"
17:31 vtomole joined
17:31 freusque joined
17:32 coot joined
17:32 Kundry_Wag joined
17:33 conal joined
17:33 <ertes> the year is 2025, GHC 12 was just released… you can hear the cheers of haskell programmers around the globe and on the moon for the final arrival of dependent types, uniqueness types and automatic proof search… suddenly a blue telephone booth appears out of nowhere and a strange guy comes out: "hey kid, is the record problem solved yet?"
17:33 osa1 joined
17:33 <sm> lol
17:34 rjg_ joined
17:34 <sm> cue Dr. Who theme music
17:35 <ystael> if SPJ were actually the doctor, or vice versa, it would explain so much
17:35 <ertes> (to anyone who didn't get the reference: <https://ro-che.info/ccc/21>)
17:36 <geekosaur> for some people it may never be solved, if they don't like the ORF solution
17:37 <geekosaur> oh, it occurs to me that enough of ORF might be in place in 8.2 to remove the need for TH when making lenses for records
17:37 <geekosaur> if there's a switch to turn it on, at least, and not just the mechanism buried somewhere inside
17:38 <ertes> i wonder if it could be done today with generics and a rather ugly type class
17:38 JuanDaugherty joined
17:39 mojjo joined
17:39 snowalpaca joined
17:40 <Cale> I don't really understand what the problem is that needs solving there.
17:41 <lyxia> http://lpaste.net/353157 <- lenses for records with Generics
17:42 <srhb> Cale: Sounds like Stockholm syndrome :-P
17:42 <srhb> _typenameMyField etc. is terribly ugly.
17:43 snowalpaca joined
17:43 <Cale> I'll agree that the underscores are ugly
17:43 snowalpa_ joined
17:43 <dolio> It's also annoying that TH divides up your file into components that do not admit forward references.
17:43 <Cale> But that's more a design decision that was made by various TH things
17:43 <srhb> The type prefix is not ugly in itself, I think, but having to write it for each field *is*
17:44 np356 joined
17:44 <robertkennedy> Category Theory: what is the thing on top of an exponential? Ie when we say "(3^4)^5 = 3^(4*5)" (uncurrying) we usually use the product type, but is there a more precise object?
17:44 buglebudabey joined
17:45 <Cale> srhb: Well, I do like being able to tell what type something is when the field extractor gets used.
17:45 patbecich joined
17:45 <srhb> Cale: Right, that's the non-ugly part. The boilerplatey repetition in the type definition is my complaint. :)
17:46 significance joined
17:47 <tobiasBora> Hello,
17:47 rjg_ joined
17:47 cyborg-one joined
17:47 <srhb> tobiasBora: Hello.
17:47 <Cale> Okay, new extension modest proposal: using record syntax in your data declaration automatically prepends the type name to the field names in the usual way
17:47 <ski> robertkennedy : "exponent" ?
17:47 <tobiasBora> Just a question, my program stoped with an exception "Error_Packet "partial packet: expecting 2088 bytes, got: 1393"
17:47 wrongway4you joined
17:48 <tobiasBora> But I put a catch on all "HttpExceptionRequest _ _" errors, so I think it's not an HttpExceptionRequest error... But then what is it???
17:48 <* ski> idly wonders how hard it would be to have light-weight records
17:48 <srhb> Cale: I would be quite happy with that. :-)
17:49 <tobiasBora> I tried to hoogle Error_Packet, but nothing is shown...
17:49 <dolio> robertkennedy: Are you asking if something other than Cartesian product could be there? I think "exponential" is specifically related to Cartesian product.
17:49 <Cale> Seems a whole lot simpler than all the craziness involved in reusing the same names
17:49 <ski> s/cartesian/categorical/
17:49 <srhb> tobiasBora: What library is this?
17:50 <ystael> Cale: did you just propose implementing C++
17:50 epsilonhalbe joined
17:50 <dolio> But there are generalizations of that to arbitrary other monoidal tensor products and "internal homs".
17:50 <tobiasBora> srhb: It's conduit (http)
17:50 <tobiasBora> https://hackage.haskell.org/package/http-conduit-2.2.3.1/docs/Network-HTTP-Conduit.html
17:50 <Cale> ystael: Does C++ do anything like that?
17:50 <ertes> lyxia: yeah, as ugly as i expected =)
17:50 <rjg_> hi are there any good tools to go through haskell code step by step?
17:51 <dolio> ski: It's the Cartesian product; they're called Cartesian closed categories, not categorical closed categories. :)
17:51 <ystael> Cale: I was thinking of the "name mangling" used to issue distinct C-ABI-level function names to class methods by class and signature
17:52 afnizarnur1 joined
17:52 <qmm> is there a common term for monoids, monads, comonads, functors, applicatives?
17:52 <ystael> it's been so long since I programmed C++ that maybe this isn't standard practice any more
17:52 <Cale> qmm: Type classes?
17:52 <qmm> besides type classes
17:52 <Cale> Those things don't have a lot in common.
17:52 <lyxia> rjg_: http://chrisuehlinger.com/LambdaBubblePop/ ?
17:53 soLucien joined
17:53 <rjg_> thank you for the link lyxia
17:54 buglebudabey joined
17:54 <srhb> tobiasBora: https://hackage.haskell.org/package/tls-1.3.10/docs/Network-TLS.html#v:Error_Packet
17:54 <tobiasBora> srhb: Great, thank you, how did you find it?
17:55 <geekosaur> qmm, for what it's worth I just typed "Functor" into it, the first few hits were definitions of the class and the rest were instances. "instance Functor" might work better but might also miss "deriving Functor". but that's a lousy query to tell noise from signal, since the signal is overwhelming :)
17:56 phyrex1an joined
17:56 <sm> rjg: maybe the GHCI debugger ?
17:56 <srhb> tobiasBora: error_packet partial packet expecting. to Google. But my search bubble is highly Haskell attuned.
17:56 <qmm> geekosaur: perfect! thank you very much
17:56 <Cale> qmm: If you drop monoids from the list, then they're all special sorts of functors.
17:57 <Cale> qmm: If you drop comonads, functors and applicative functors, monoids and monads are both examples of monoid objects.
17:57 nmdanny joined
17:58 Luke joined
17:58 buglebudabey joined
17:58 <qmm> geekosaur: there aren't as many results as i thought there would be
17:58 <isaac_> what is the difference between sum and coproduct?
17:58 <Cale> isaac_: They're synonymous.
17:58 <qmm> https://hayoo.fh-wedel.de/?query=deriving+Functor has a little over 20 results
17:58 <dolio> Cale: Comonads are monoid objects if you flip the category. :P
17:58 <Cale> That's fair enough :D
17:58 <qmm> Cale: thanks :)
17:59 slomo joined
17:59 slomo joined
17:59 <geekosaur> I didn't suggest "deriving FUnctor" as a query, I said that a search for "instance Functor" might miss the ones that derive it instead of writing a direct instanc
17:59 <Cale> and they're comonoid objects if you don't
17:59 kaen_ joined
17:59 <ertes> qmm: "algebraic structures"?
18:00 coltfred joined
18:00 <geekosaur> because I don't know how hayoo indexes stuff. (although ideally it'd handle it properly since it's supposed to be trying to do a type search not a text search --- your query being a demonstration that it's not doing text search :)
18:00 <rjg_> sm: I tried to step through my main function with :step, but I can only see a ¨_result¨ variable, is this correct?
18:00 <qmm> geekosaur: i guess i do want "instance Functor"
18:00 connrs joined
18:00 <qmm> thanks again
18:00 <sm> rjg_: it's very tricky at first, best read the docs carefully
18:01 <qmm> ertes: i'm just confused i guess
18:01 <qmm> :k []
18:01 <lambdabot> * -> *
18:01 <qmm> :k Functor
18:01 <lambdabot> (* -> *) -> Constraint
18:01 <qmm> :k Monoid
18:01 <lambdabot> * -> Constraint
18:01 <qmm> :k Monad
18:01 <lambdabot> (* -> *) -> Constraint
18:01 AtnNn joined
18:01 <ertes> qmm: you can talk to lambdabot in private
18:02 jsgrant joined
18:02 <ertes> and of course your local GHCi will tell you the same things (usually) =)
18:02 dddddd joined
18:02 <qmm> it did! :)
18:02 fizruk joined
18:03 <rjg_> sm: I am trying to find the source of a possible infinite loop, but the step does not give me enough information, is it possible to make smaller steps or make the output more verbose?
18:03 <qmm> it seems like functor, monoid, and monad are a level higher than []
18:03 coot joined
18:03 <qmm> the phrasing is probably incorrect
18:03 <geekosaur> [] is a type constructor, the others are constraints
18:04 <ertes> rjg_: GHCi does support breakpoints, but you need to at least have an idea where the infinite loop might be
18:04 <sm> rjg_: I often find print or trace statements (Debug.Trace) a quick way to locate those
18:04 <geekosaur> ([] Int) is the same as [Int]
18:04 <ertes> rjg_: and i agree with sm… Debug.Trace is often much easier to use than GHCi's debugging features
18:05 <erisco> I usually debug by simplifying
18:05 <sm> that too
18:06 <erisco> can I break this into smaller steps that I can individually verify
18:06 <erisco> or can I approach this differently in a way that is less confusing
18:06 orbifx joined
18:06 UberLambda joined
18:06 sleffy joined
18:06 <sm> don't forget to explain the situation to the rubber duck
18:07 <ski> isaac_ : i think "sum" is usually used if you have a distributive law
18:07 <rjg_> thanks for the tips
18:07 <ski> dolio : never heard them called "Cartesian products" in the general case, before
18:07 <nmdanny> Does anybody here know about using HXT(xml library)? I'm having a weird result when transforming an Xml document
18:08 freeside joined
18:08 <ertes> the proper way to use hxt is to switch to xml-conduit or something else
18:08 <monochrom> haha
18:09 <nmdanny> I tried using xml-conduit but I didn't find a nice way to manipulate documents
18:09 <rjg_> how does the ¨trace¨ function work? It looks pure but how can it have side effects
18:09 <erisco> rjg_, it contains cheat codes
18:09 <sm> it's a secret
18:10 <nmdanny> anyway, when transforming XML via HXT, I get some weird xml tag added to the output
18:10 <ertes> nmdanny: "<?xml … ?>"?
18:10 <nmdanny> e.g when processing <Item></Item>, I get: </ transfer-MimeType="text/xml" transfer-Status="200" transfer-Message="OK" transfer-URI="file:///C..." source="....xml" transfer-Encoding="UTF-8"><Item></Item>
18:10 mizu_no_oto_work joined
18:10 <ertes> ah
18:10 <rjg_> wow cool
18:10 <freeside> wow, your XML has eaten HTTP
18:11 <freeside> it has, like, XHTML envy
18:11 <nmdanny> wat
18:11 cmsmcq__ joined
18:11 <nmdanny> I haven't enabled hxt-http or something similar.. and i'm dealing with a file on my own computer
18:12 ptek joined
18:12 ertesx joined
18:12 <erisco> I don't know if outputs should be relevant to purity, but that's a rabbit hole
18:13 <erisco> if you discount those then you also solve the time and heat issue
18:13 <ertesx> nmdanny: i found this: https://hackage.haskell.org/package/xml-lens
18:13 <ertesx> list release is from 2015, but it probably still works
18:13 <ertesx> *last
18:14 <nmdanny> I was actually interested in using this but my lens skills aren't pretty good
18:14 <erisco> bbl
18:14 <nmdanny> and I already figured how to use arrows and such..
18:14 <ertesx> nmdanny: well, this might be a good opportunity to improve them
18:15 <ertesx> arrows are exactly the reason why i wouldn't use hxt
18:15 Itkovian joined
18:15 <nmdanny> why not?
18:15 <ertesx> hxt doesn't actually have any *proper* arrows… it's just using arrows for the sake of using arrows
18:16 <Cale> Yeah, I never understood that decision
18:16 <nmdanny> what do you mean by 'proper', are they not law abiding or something as such?
18:16 <Cale> It actually had a monadic interface at one point
18:16 <ertes> nmdanny: all of them have a monadic variant
18:16 <ertes> in other words they are all kleisli arrows
18:16 <nmdanny> oh yes, because they all implement ArrowApply right?
18:16 <ertes> yes
18:17 connrs joined
18:17 <ertes> so all the arrow interface does is to bloat the types and make source code awkward to write
18:18 <Cale> They're "law abiding" insofar as Kleisli arrows of arbitrary monads are, but they won't satisfy the law that I think all good instances of Arrow really ought to satisfy
18:18 <Cale> which is (f *** g) >>> (h *** k) = (f >>> h) *** (g >>> k)
18:19 <Cale> Without that law, you can't easily draw diagrams explaining your arrow computations without explicitly drawing boxes around every combination, so that you can see whether things are vertically or horizontally composed first
18:19 <Cale> (which makes things super ugly)
18:20 <ertes> to be fair that's more a feature of the underlying monads… they have global state
18:20 <Cale> Well, right
18:21 allenj12 joined
18:21 <Cale> It's kind of similar to electronic circuits which don't follow the usual circuit abstraction that components are independent of one another.
18:21 <Cale> Only... it's almost worse, because it's how you carve up the diagram vertically or horizontally which makes the difference
18:22 Apocalisp joined
18:22 ozgura joined
18:22 <nmdanny> well HXT aside, what other viable XML manipulation libraries are there in haskell?
18:23 <nmdanny> xml-lens doesn't seem to very used
18:23 <Cale> It's kind of old, but I remember using hexpat-pickle and not hating it
18:23 <dolio> I don't think you need "global state" to have a problem.
18:23 <dolio> Unless it's defined very broadly.
18:23 <Cale> A newer one is xml-conduit
18:23 <dolio> Kleisli [] probably doesn't have that property, either.
18:23 <pikajude> hexpat-pickle is a lot more useful than xml-conduit is
18:23 <pikajude> in my personal opinion
18:24 <cocreature> I’ve only used xml-conduit but so far I’ve been quite happy with it
18:24 <Cale> Ah, see, I haven't actually tried to use xml-conduit
18:24 <nmdanny> I'm not interested in pickling/unpickling the data,
18:24 <nmdanny> I need to manipulate XML trees and such
18:24 <pikajude> I used xml-conduit for a side project for work for about 5 minutes
18:24 <pikajude> it wasn't suited for that specific project
18:24 <dolio> Kleisli m probably only has that property for commutative m.
18:24 <rjg_> is it possible to keep definitions each time a hs file is reloaded?
18:25 <monochrom> Yes. Put them in that file.
18:25 <Cale> rjg_: Put them in the .hs file
18:25 <Cale> I actually almost wish that GHCi would go back to not accepting declarations
18:25 <monochrom> Or revise GHCi to do what you want. :)
18:25 <sm> what about ertes's http://hackage.haskell.org/package/rapid
18:26 Itkovian joined
18:26 <rjg_> but isn´t it bad practice to clutter your source code with mock data
18:26 <sm> because put it in the hs file isn't great when you're interactively exploring
18:26 <Cale> When I learned Haskell, GHCi was simple: you loaded a file containing declarations, and it took expressions only
18:26 <ertes> nmdanny: in a library like xml-lens, the age is probably not as important, as long as it still works
18:26 <Cale> If the expression was an IO action, it would execute it (only)
18:27 <monochrom> Yes, so put your mock data and an import line in a new file, and load this new file instead.
18:27 <Cale> If not, it would try to apply print to it for you and execute that.
18:27 <ertes> nmdanny: in any case i'd go for lenses/traversals there
18:27 <ertes> rjg_: yes, rapid allows you to keep data resident
18:27 <monochrom> Like, if I'm testing out my XXX.hs, I don't load XXX.hs. I write play.hs to say "import XXX; example1 = x y". I load play.hs.
18:28 <ertes> rjg_: https://hackage.haskell.org/package/rapid-0.1.3/docs/Rapid.html#g:3
18:28 beerdrop joined
18:28 <Cale> I don't even regard it as all that bad to put some mock data into your file if your program is only one module anyway.
18:29 <nmdanny> are there any examples or documentation of using xml-lens, for instance?
18:29 buglebudabey joined
18:29 _sg joined
18:29 <sm> ertes: to persist something across reloads, you have to have previously set up a reference for it in the source, is that right ?
18:30 <nmdanny> I want to do something like: edit an XML in-place, drill down to some node, map its children(e.g append some nodes)
18:30 oberstein joined
18:32 connrs joined
18:32 <ertes> sm: yes, the tutorial explains the whole process
18:32 <rjg_> ertes: is it possible to integrate ¨rapid¨ with vim?
18:32 <sm> bah, GHCI should just automatically pickle your state
18:33 <ertes> rjg_: that's more a vim question than a rapid question… rapid itself is simply a library you use from GHCi
18:33 cjwelborn joined
18:33 Kundry_Wag joined
18:33 <sm> even if just dumped pretty-print of bound values on exit, that'd be quite useful
18:33 <ertes> rjg_: i don't know the answer though… it's certainly possible, but i'm not aware of anything ready-made
18:34 <ertes> rjg_: it does integrate well into emacs at least
18:34 <monochrom> "patches welcome"
18:34 <rjg_> ertes: oh ok thanks, I saw that it could be integrated into editors so I thought it was a plugin
18:35 <ertes> rjg_: i try not to write more elisp than necessary =)
18:35 <ertes> haskell-mode kindly already had the hooks needed =)
18:36 <monochrom> You wouldn't believe how 50% of the economy of GHC's development is the economy of how to get some academic papers published. (And therefore not how much you want an REPL feature.)
18:36 <monochrom> And the other 50% is Simon Marlow being exceptionally selfless. But I get to say the exception proves the rule.
18:37 <rjg_> ertes: is the rapid library a workaround for a missing feature of GHCi? It looks pretty complicated
18:37 iomonad joined
18:37 giraffe joined
18:38 <ertes> rjg_: i guess that's a question of philosophy… in principle it could be a GHCi feature, i guess
18:38 afnizarnur1 left
18:38 afnizarnur1 joined
18:38 <geekosaur> nevertheless people do submit ghci features, and there's even a package to help you develop them without having to hack ghc directly (ghci-ng)
18:39 <ertes> rjg_: if it had better support from GHC, it could at least be a lot safer
18:39 oish joined
18:39 <ertes> right now it uses the foreign-store library, which is a *major* hack
18:40 stef204 joined
18:41 joshuagross joined
18:42 joshuagross left
18:45 unK_ joined
18:45 kolko joined
18:45 dsh joined
18:46 migge joined
18:46 systemfault joined
18:47 mr_sm1th joined
18:48 Kardoso joined
18:48 oberstein joined
18:49 marr joined
18:50 BlueRavenGT joined
18:50 xall joined
18:50 kolko_ joined
18:53 <rjg_> is it possible to capture an intermediate value in between multiple composed functions? So a bit like @, without having to split up the chain with let..in or where
18:55 Noldorin joined
18:56 <rjg_> for example for debugging purposes
18:57 <Cale> > ap ((,) . reverse) (map toUpper) "hello"
18:57 <lambdabot> ("olleh","HELLO")
18:57 <Cale> heh
18:58 <Cale> just define the intermediate value :P
18:59 <Cale> (that didn't work, because reverse was only applied to the first argument of course)
19:00 <Cale> @pl \x -> (f x, g (f x))
19:00 <lambdabot> liftM2 (,) f (g . f)
19:00 <Cale> well, sure
19:00 <Cale> heh
19:01 <Cale> Oh, I guess it could be:
19:01 <Cale> > ap (,) (map toUpper) . reverse $ "hello"
19:01 Rodya_ joined
19:01 <lambdabot> ("olleh","OLLEH")
19:01 <Cale> yeah!
19:02 <glguy> you can use trace or the GHCi debugger
19:02 connrs joined
19:02 <mnoonan> Something must be wrong with me to prefer `(id &&& map toUpper) . reverse` :)
19:03 <Cale> I don't really like any of them
19:03 <Cale> Use lambda
19:04 desku joined
19:04 meck joined
19:04 <dolio> Use a debugger.
19:04 binaryplease joined
19:05 <sm> rjg_: yes, especially if the value is showable, traceShowId is very useful
19:05 <ertes> rjg_: (\x -> traceShow x x)
19:05 <ertes> or (join traceShow), if you prefer
19:06 <ertes> ah, apparently it's predefined =)
19:06 <rjg_> thanks
19:06 <sophiag> i'm a bit confused about how to structure a data type constructor to store lambdas and wondering if someone could give me a hand. here's the relevant code: http://lpaste.net/354152
19:07 <sophiag> the problem is i need Eq as a constraint on the value returned by parseOp and learned it doesn't play nicely with existential quantification. i'm fine providing a type for the lambda since it would match that of the value returned by parseLiteral, which i can make Typeable, however i'm still confused about how to pass the lambdas i've put together to the constructor themselves. does that make sense?
19:07 <sm> http://hackage.haskell.org/package/hledger-lib-1.1/docs/src/Hledger-Utils-Debug.html#traceWith is also useful
19:07 <sm> ha, the code would have been shorter
19:07 thoradam joined
19:08 coot joined
19:09 Itkovian joined
19:09 sypwex joined
19:09 <Cale> sophiag: I'm a little confused about what the input expression is there
19:09 <Cale> sophiag: Also, does an operation of this type really make much sense? Most expressions aren't going to be lambdas, are they?
19:10 <sophiag> it's for parsing a dsl
19:10 <sophiag> and just the parts of it that are definitely going to be lambdas
19:11 <sophiag> i was told i can create a constructor for functions by just using their type signatures (so a -> Bool in this case), but then i'm confused about how i pass both a _and_ the actual implementation
19:11 <Cale> You don't... but also that's probably not a good representation for a lambda that you're going to be interpreting.
19:12 <sophiag> i'm not sure what you mean.
19:12 <sophiag> they'll all have that type signature and all be of one variable
19:12 <Cale> Well, a lambda consists of some variable which is being abstracted over, and then a body
19:13 grillon joined
19:13 <sophiag> i haven't yet gotten to parsing compound expressions, but otherwise i know all of _these_ lambdas will be of that form
19:14 <sophiag> in other words just one bound variable on the lhs of an infix expression
19:14 <Apocalisp> I've made a monad transformer FooT and a class (Monad m) => MonadFoo m. Now I want something like instance (MonadFoo m, MonadTrans t) => MonadFoo (t m). But I need to prove Monad (t m). How to resolve this?
19:14 <Cale> Apocalisp: You can't write an instance like that.
19:14 vtomole joined
19:15 <Apocalisp> didn't think so but I can't articulate why
19:15 Aruro joined
19:15 <Cale> Perhaps you meant: instance (Monad m) => MonadFoo (FooT m) ?
19:15 <Cale> The reason why is that instances have to match on type constructors
19:16 <Cale> You're not allowed to write an instance which applies to just any type application whatsoever
19:17 locallycompact joined
19:17 rjg_ joined
19:17 osa1 joined
19:17 <Apocalisp> ok, makes sense
19:17 <dolio> Well, GHC will let you if you turn on enough extensions. But you shouldn't do it.
19:18 <Apocalisp> :)
19:18 <Cale> Yeah, it'll overlap with almost anything
19:18 <Cale> and you'll have problems
19:18 meba joined
19:19 ptek joined
19:19 <Cale> Apocalisp: an important thing to keep in mind is that when deciding which instance applies in any particular case, the resolver can't and won't consider the type class constraints on the instances
19:19 marsam joined
19:19 <Cale> Those only get checked once it finishes committing to a particular instance
19:19 yellowj joined
19:19 <Cale> It only looks at the structure of the type, and matches it against the patterns in the instance heads.
19:20 <freeside> pedagogically, wouldn't it be better to first learn how to do monad transformers without involving typeclasses?
19:20 <Apocalisp> What about the case where Foo is just a monad (not a transformer), and I have class (Monad m) => MonadFoo m where liftFoo :: Foo a -> m a. Then I find myself writing instance MonadFoo m => MonadFoo (ReaderT m), etc.
19:21 chaosmasttter joined
19:21 <Cale> freeside: Well, you need to know enough about type classes to at least do the Monad and MonadTrans instancez
19:21 <Cale> s*
19:21 <Aruro> after ghc 8 doing monad became pain
19:22 <Aruro> u need to implement 4 extra classes
19:22 <Cale> Apocalisp: yes.
19:22 <Aruro> or hack like undefine
19:22 <Cale> Aruro: hm?
19:22 <ertes> Aruro: derive Functor, write Monad without 'return'
19:22 <Aruro> need applicative
19:22 <ertes> yes, define full Applicative, but for Monad you can leave out 'return'
19:23 <monochrom> Which 4 extra classes? I only know 2.
19:23 <Aruro> Functor + Applicative + Monad and if u Want then transformer
19:23 <Cale> I would just write the Monad instance, and then instance Functor MyThing where fmap = liftM; instance Applicative MyThing where { pure = return; (<*>) = ap }
19:23 <ertes> in most cases it's good enough to just define 'pure' and (>>=) and then: (<*>) = ap
19:23 <jle`> what undefine hack do you mean, heh
19:23 <Apocalisp> Cale: So I need MonadFoo (ReaderT r m), MonadFoo (StateT s m), MonadFoo (LoggingT m)... but they're all identical
19:23 <Cale> Apocalisp: yes.
19:23 <Apocalisp> I guess the solution is to make FooT
19:23 <Aruro> jle`: if u want to make use of old examples from haskell tutorials, u can hack with undefined
19:23 <dolio> If you weren't defining Functor and Applicative before, I would have recommended that no one use your code.
19:23 <jle`> what undefined hack do you mean?
19:24 <Aruro> dolio: seriously?
19:24 <dolio> Absolutely.
19:24 <Aruro> makers of haskell did not know about applicative, please dont use it
19:24 <Aruro> i mean haskell
19:24 <Cale> Aruro: Applicative has been around for quite a while though.
19:24 <Aruro> look at first report, with such high bars u have set :)
19:24 <Cale> and not supporting it at this point is annoying
19:25 <monochrom> First report? Haskell 0.4?
19:25 <ertes> Apocalisp: if you look at mtl, you will find that they do exactly the same thing
19:25 <Aruro> u have to first teach it right, and then Demand
19:25 <Cale> But even from the beginning, it was a mistake not to make Functor at least a superclass of Monad.
19:25 xall joined
19:25 <ertes> Apocalisp: monad transformers with effect classes suffer from the expression problem there
19:25 <jle`> Aruro: what hack with undefined are you talking about?
19:25 <lyxia> Is there a GHC.Generics implementation of generic zippers?
19:25 <Cale> In mathematics, monads are functors equipped with extra information.
19:26 <Cale> So it doesn't entirely make sense why they weren't a subclass of Functor from day 1 -- just an oversight by the committee.
19:26 <dolio> People have had 10 years to start teaching it. Why are they so slow?
19:26 <jle`> the first versions of haskell didn't have monad, either, for what it's worth
19:26 <Cale> Applicative came along a good bit later, but it's basically proven itself useful enough.
19:26 <Aruro> i find it unjustified to talk about oversight After things happen
19:26 <Aruro> a bit strange
19:27 <Cale> Well, yeah, the first versions of Haskell didn't have constructor classes.
19:27 initiumdoeslinux joined
19:27 <Cale> You could only define type classes for types of kind *
19:27 <jle`> so talking about the first versions of haskell doesn't have too much weight
19:27 <jle`> Aruro: if you mean something like 'instance Functor m where fmap = undefined', you don't need undefined there
19:27 <jle`> Aruro: you can just write 'instance Functor m' to mean the same thing
19:28 <Cale> Aruro: if you're going to write fmap = undefined, why not just write fmap = liftM ?
19:28 <Cale> You'll get a reasonable instance.
19:28 <Cale> (assuming you wrote a reasonable Monad instance)
19:28 <monochrom> My high standard is if you write I/O code with [Response] -> [Request], I won't want to read your code, unless you pay me well.
19:28 <ertes> and again, most of the time you can just derive Functor
19:28 mmachenry joined
19:28 <monochrom> So now point me to Haskell 1.2 to chastise me or something.
19:29 <ertes> the advantages of the new class hierarchy far outweigh the requirement to write a bit more code, honestly
19:29 <Cale> We need an acme-response-request
19:29 <Cale> a backwards compatibility layer with early Haskell
19:29 binaryplease joined
19:29 <Aruro> it does outweight, but now to write monad u really need to understand all major classes
19:29 <monochrom> Yes! What should be in it? Maybe be just in time for tomorrow April 1st. :)
19:29 <ertes> also Functor and Applicative could easily be extended to use default signatures
19:29 <Aruro> since they are superclasses now
19:29 <jle`> Aruro: you don't need to
19:29 <ertes> instance Functor F; instance Applicative F; instance Monad F where …
19:29 hololeap joined
19:30 <jle`> you can just write instance Functor Foo where fmap = liftM
19:30 <Aruro> if u want tranformer more instances may be needed
19:30 <jle`> and instance Applicative Foo where pure = return; (<*>) = ap
19:30 <Cale> Basically the Request and Response types from one of the early Reports, and a function ([Response] -> [Request]) -> IO ()
19:30 <jle`> you don't need to understand them
19:30 <jle`> you just need to barf out boilerplate, i suppose
19:30 <Aruro> :)
19:30 Tharbakim joined
19:30 Tharbakim joined
19:30 <hololeap> i'm trying to understand how (enumFromTo :: Enum a => a -> a -> [a]) is implemented without `a` also being a part of the Eq class
19:31 <jle`> hololeap: enumFromTo is a part of the Enum typeclass
19:31 <jle`> so each class gets to define its own implementation
19:31 <Cale> each instance
19:31 <jle`> yes, each instance :)
19:31 <rjg_> how can I get an object a from a list such that when you apply the function f to all elements on that list, f(a) has the biggest value
19:31 <jle`> rjg_: maximumBy
19:31 <hololeap> but the "to" part is what confuses me. how does it know to stop at the second `a` without using a comparison
19:31 <jle`> > maximumBy (comparing negate) [1..10]
19:31 <lambdabot> 1
19:31 <jle`> hololeap: that's up to each individual instance to figure out
19:31 <Cale> > maximumBy (flip compare) [1..10]
19:31 <lambdabot> 1
19:32 <jle`> hololeap: so, the instance for Int would probably use (==)
19:32 rjg_ joined
19:32 <sophiag> Cale: what do you think about my lambda datat type situation? does it make more sense to have something like: "data LambdaT a f = (Eq a) => LambdaType (a -> Bool) f"
19:32 <Cale> sophiag: Can I see the rest of your definitions?
19:32 <Cale> sophiag: I'm not sure I fully understand what you're after :)
19:32 <jle`> > maximumBy (comparing length) ["hello","hi","what is up","how doing"]
19:32 <lambdabot> "what is up"
19:33 <jle`> hololeap: if the individual instance you are writing has (==), then you can use it
19:33 <rjg_> thanks jle
19:33 <jle`> note that this doesn't do any caching
19:33 <Aruro> rjg_: (maximum . map myF ) list
19:33 <jle`> so if the mapping function is expensive you might want to memoize the results
19:34 <jle`> Aruro: that gives you the maximum f(a)
19:34 cobreadmonster joined
19:34 <jle`> Aruro: but rjg_ wanted the maximum 'a'
19:34 <Aruro> jle`: my appologies, did not think enough
19:34 <jle`> no need to aplogize to me :)
19:34 <Aruro> :)
19:34 <Cale> > snd . maximum . map (length &&& id) $ ["hello","hi","what is up","how doing"]
19:34 <lambdabot> "what is up"
19:35 <sophiag> Cale: it's that paste from before
19:35 napping joined
19:35 <hololeap> but the minimal definition for Enum is just `toEnum` and `fromEnum` so that tells me that enumFromTo is implemented generically. unfortunately, in the source code it is just defined as `[f .. t]`
19:36 Itkovian joined
19:36 marsam joined
19:36 <Cale> sophiag: I'm not sure I still have the link...
19:36 <sophiag> Cale: although i changed it to use a let statement, which seems to make more sense
19:36 <jle`> hololeap: the minimal definition uses [fromEnum f .. fromEnum t]
19:36 <sophiag> ok, lemme repaste with more :)
19:36 <jle`> hololeap: so it's using the Enum instance of Int
19:37 <hololeap> i see
19:37 <hololeap> that makes sense now
19:37 <jle`> > [fromEnum LT .. fromEnum GT]
19:37 <lambdabot> [0,1,2]
19:37 al-damiri joined
19:37 <rjg_> jle`: what do you mean with that it doesn't do any caching? That it does not store the results?
19:37 <jle`> rjg_: yes, it recomputes the result of the function on every comparison
19:37 <jle`> on the "currently seen maximum"
19:37 <jle`> er, the current known maximum
19:38 <jle`> so if your maximum is the first item in the list, it recomputes the function on every subsequent comparison
19:38 <jle`> or well, it would do that even if it wasn't the first item
19:39 <jle`> i guess you can say that for a list of length n, the function is applied 2n times.
19:39 <jle`> Cale posted a version that caches the image of the function that only applies the function n times
19:39 <jle`> same asymptotics though, so it probably isn't a big deal in most programs
19:40 <rjg_> thanks, I guess for small cases the n times version is better
19:40 <jle`> for small cases the naive version probably isn't much slower
19:41 <jle`> if your program's runtime is dominated by this maximum-finding, then it would probably make a difference, though
19:41 yqt joined
19:43 orbifx joined
19:43 Itkovian joined
19:43 <rjg_> hmm but what does &&& mean?
19:43 alexelcu joined
19:44 <nmdanny> is it possible to use letters inside custom operators? e.g define the following operator "=ci="
19:45 <jle`> rjg_: (f &&& g) = \x -> (f x, g x)
19:45 <jle`> nmdanny: it is not
19:45 hvr joined
19:45 hvr joined
19:46 <sophiag> Cale: here's the full code modified a bit trying another way to do it. i have an error from unwrapJust on line 37 i thought i was able to resolve yesterday, though :/
19:47 rjg_ joined
19:47 <jle`> rjg_: actually after trying it out in ghc it looks like the non-caching version is faster when the function is cheap, cause of the overhead from generating the tuple
19:48 <jle`> *ghci
19:48 <jle`> results might be different in compiled -O2 though.
19:48 <rjg_> ah
19:49 sirkitree joined
19:51 {emptyset} joined
19:52 azahi joined
19:52 epsilonhalbe left
19:52 <sophiag> Cale: i updated it to not use existential quantifcation with the RhsT type: http://lpaste.net/354152
19:54 <sophiag> so really it seems my issue is just how it's reading the type signature from the lambda. in other words, the AST types of op and rhs don't actually matter. it needs to be something like: "(typeOf rhs) -> Bool"
19:56 nick_h joined
19:57 <sophiag> i'm trying providing a type signature inside the function, but clearly not doing it right: "func :: typeOf rhs -> Bool"
19:57 <jle`> upset at myself that i wasn't able to think of a good haskell april fools in time this year
20:00 osa1 joined
20:00 osa1 joined
20:01 deepfire joined
20:01 splanch joined
20:02 <Apocalisp> Given State (a,b) m, can I get MonadState a m and MonadState b m?
20:02 <dolio> jle`: You still have a few hours.
20:02 rjg_ joined
20:03 <Apocalisp> sorry, make that ...
20:03 oisdk joined
20:03 <jle`> Apocalisp: yes
20:03 <napping> Apocalisp: no, there's a functional dependency saying m has to determine the state
20:04 <jle`> oh wait
20:04 <jle`> no, because it's not well-kinded
20:04 <Apocalisp> can I get MonadState a (State (a,b)) and MonadState b (State (a,b))?
20:04 <jle`> you use m as * first, but then you use it as * -> *
20:04 <dolio> Apocalisp: What happens if a = b?
20:04 oish joined
20:04 <jle`> MonadState :: * -> (* -> *) -> Constraint, so the second argument has to be (* -> *)
20:05 <Apocalisp> yeah, sorry, poorly kinded question
20:05 revprez_atlanta joined
20:05 <napping> Apocalisp: not that either, there's a functional dependency
20:05 WarmCookie joined
20:05 <napping> unless you are not using mtl?
20:06 <WarmCookie> Can someone with a bit of knowledge of rust-lang brief me on what a typical Haskell user would complain about while working with that language?
20:06 <napping> even if there wasn't the overlap would be problematic
20:06 <jle`> i think i might have a seen a 'six months with rust' kind of post from the perspetive of a haskell user not to long ago
20:06 <napping> Maybe something like zoom from lens would help?
20:06 <jle`> yes, a big-picture idea of what you actually want would shed some insight and allow for more useful answers
20:06 <monochrom> jle`: Usually I think up or discover in #haskell a good idea on April 2nd.
20:06 <WarmCookie> I know that their support of higher-kinded polymorphism is near inexistant, but what problems does it creates pratically?
20:07 coot joined
20:07 <jle`> i mean, without higher kinded polymorphism, there's no functor, applicative, traversable, monad ...
20:07 <jle`> no anything
20:08 revprez_atlanta joined
20:08 <Apocalisp> dolio: That illustrates the problem nicely, thanks
20:08 <napping> Apocalisp: zoom _1 can have type State a x -> State (a,b) x
20:08 <WarmCookie> jle`: Don't they have some trait system for like, at least a `map` operation for container-like types and similar?
20:09 <Apocalisp> napping: Yeah awesome, I think I'll have use of the MonadState combinators from Lens
20:09 nut joined
20:09 <napping> WarmCookie: I think it's mostly with iterators
20:09 <napping> A type changing map is kind of problematic if you worry about storage layout
20:09 oisdk joined
20:10 <itachi> what does it mean when we say a function is pure?
20:10 coot joined
20:10 <nut> itachi: It means it doesn't have side effect
20:11 fairfieldt joined
20:11 <nut> itachi: side effects are things like IO
20:11 <infandum> itachi: Double -> Double means Double -> Double, nothing else is returned or executed
20:11 <itachi> why is having side effects harmful?
20:11 <infandum> whereas in python, you could have a (+) function that is Double -> Double but also prints "howdy doody"
20:11 <infandum> or queries a web server
20:11 <dolio> Because having side effects means you have to worry about the exact order things happen a lot more.
20:12 <dolio> Which is mental overhead.
20:12 <napping> itachi: in particular, if f :: Double -> Double, then you should always have that some expression .... (f x) ... (f x) ... behaves exactly like let y = f x in .... y ... y ...
20:12 <nut> itachi: It's harming in the sense that you don't get the same result every time you run your code. It depends on the outside world
20:12 <itachi> makes sense
20:13 <jle`> it's much harder to understand and debug side-effecting code
20:13 splanch joined
20:13 <infandum> That got me thinking.
20:13 pera joined
20:13 <jle`> like, a bajillion times
20:13 <WarmCookie> nut: I think IO is supposed to model effects, not side effects.
20:13 aarvar joined
20:13 <infandum> What happens if you use a library who uses unsafePerformIO?
20:13 <napping> lots more rearangements of code are correct when everything is pure
20:13 <itachi> model effects?
20:13 <WarmCookie> Side effects are undesirable; effects with IO are perfectly fine.
20:13 Itkovian joined
20:13 <jle`> IO *describes* effects
20:13 <infandum> Even if all of your code is pure, that wouldn't matter because it isn't really
20:13 <napping> infandum: It's either observably pure, or you write nasty letters to/about the author
20:13 <jle`> it doesn't do side-effects
20:14 <nut> by IO I don't mean the IO monad
20:14 <infandum> napping: Haha yeah I figure that'd be the only solution. I've seen plenty of libraries that look find but use unsafePerformIO because of...well I'm not sure
20:14 <infandum> look fine*
20:14 <infandum> lots of numerical ones and ones that use state from what I remember
20:15 takle_ joined
20:15 splanch_ joined
20:15 <infandum> napping: By observably pure you mean in the code? Not empirically?
20:16 <jle`> infandum: if a library uses unsafePerformIO, it is expected that they preserve pure semantics
20:16 Discovery joined
20:16 <Apocalisp> unsafePerformIO is sometimes necessary when calling out to C libraries
20:16 takle joined
20:16 <dolio> WarmCookie: This isn't Rust, but if you look at Scala's collections, they too abstract 'mapping' through traits and subtyping. And when you use the abstraction, you tend to lose the information about what container type you're working with.
20:16 <jle`> it's all about providing a well-behaving abstract API
20:16 MoALTz_ joined
20:17 <jle`> unsafePerformIO must only be used in situations where the semantics of the resulting abstract API is pure
20:17 <dolio> It is not the abstraction I usually want. I want to map and get back the same container type. So in practice we end up converting back down by calling `toFoo` everywhere. And it gets noisy.
20:17 <itachi> what is the use of ">>" in monad?
20:17 yellowj joined
20:17 <jle`> itachi: the behavior depends on the instance
20:17 <Apocalisp> unsafePerformIO should be renamed uncoolPerformIO for the new generation
20:17 <dolio> WarmCookie: The difference is, Scala could give the abstraction I want, but doesn't, whereas Rust can't.
20:17 <jle`> itachi: for IO, it sequences two IO actions
20:17 systemfault joined
20:18 <jle`> itachi: remember that a value of type 'IO a' describes a program
20:18 <Apocalisp> or unspeakableEldritchPerformIO
20:18 <jle`> itachi: so if x and y are bith IO a, then (x >> y) describes a program that has the effects of a, and then does the effects of b
20:18 <jle`> (x >> y :: IO a), as well
20:18 <jle`> but every intsance of Monad can define its own (>>) to behave in its own appropriate way, that might not have anything to do with IO's >> necessarily.
20:18 <itachi> hmm
20:19 jao joined
20:19 <Apocalisp> a >> b = do { a; b }
20:19 <WarmCookie> > [0,0,0] >> [1,2,3]
20:19 <nut> itachi: putStrLn "hello" >> putStrLn "world", try it
20:19 <lambdabot> [1,2,3,1,2,3,1,2,3]
20:19 <jle`> itachi: a value of type (IO a) is nothing more than a data type describing IO actions/effects, so (>>) is a neat combinator that lets you build complex IO actions from simpler 'primitive' ones
20:20 <jle`> itachi: kind of like (++) for lists, it lets you build complex lists from simpler lists
20:20 <jle`> > [1,2,3] ++ [4,5,6]
20:20 <lambdabot> [1,2,3,4,5,6]
20:20 <itachi> k
20:20 <Aruro> :t (>>)
20:20 <lambdabot> Monad m => m a -> m b -> m b
20:20 <itachi> a>>b will first do "a" then "b"
20:20 <Aruro> and ignore a
20:21 splanch joined
20:21 <WarmCookie> (And join the effects of the the two m's into the final m)
20:21 <itachi> by ignore a you mean results of "b" wont depend on a
20:21 <Aruro> yes, but effects of m a will be performed
20:22 <jle`> yes, it'll sequence the effects, but drop the result of the left hand side
20:22 <jle`> fun stuff
20:22 <WarmCookie> f >> g = f >>= \_ -> g
20:22 <itachi> I did not get how "[0,0,0] >> [1,2,3]" returns "[1,2,3,1,2,3,1,2,3]"
20:22 <Aruro> itachi: because u did not look at list instance of monad
20:23 <* itachi> checks
20:23 <jle`> itachi: like i said earlier, every monad instance is free to define >> however it wants
20:23 <jle`> itachi: that's just how the list intsance defines it
20:23 <WarmCookie> itachi: Each `0` is replaced with [1,2,3], then all these [1,2,3] are concatenated is per the semantic of the list monad.
20:23 <jle`> for lists, xs >> ys = [ y | _ <- xs, y <- ys ]
20:23 <nut> itachi: that list example is confusing for beginners. the >> has different behavior for different monad. you have to check how >> is implemented for list
20:24 <itachi> I think i somewhat get it now
20:24 <jle`> yes, one of the common roadblocks people encounter when trying to 'learn monads' is to think that the different instances have that much in common in their implementations
20:24 <jle`> but the different monad instances are all really different types, so you can't really expect their monad instances to be related to eachother that muc
20:25 govg joined
20:25 <itachi> k will keep that in mind
20:25 <jle`> > [ y | _ <- [0,0,0], y <- [1,2,3] ]
20:25 <lambdabot> [1,2,3,1,2,3,1,2,3]
20:25 <jle`> (>>) is useful for lists because the left hand side can "kill" the right hand side
20:26 <jle`> > [ y | _ <- [], y <- [1,2,3] ]
20:26 <lambdabot> []
20:26 <jle`> > [ y | _ <- [(),()], y <- [1,2,3] ]
20:26 <lambdabot> [1,2,3,1,2,3]
20:26 <jle`> > [ y | _ <- [()], y <- [1,2,3] ]
20:26 <lambdabot> [1,2,3]
20:26 <jle`> etc.
20:26 <jle`> (ignore the middle example with [(),()])
20:26 <itachi> yup get it now thanks
20:26 <itachi> :)
20:26 <jle`> the left hand side can choose to kill ys, or just returns it as-is
20:26 <WarmCookie> I like the middle example to show it can also duplicate the right hand side.
20:26 <WarmCookie> *replicate
20:27 <jle`> all of the monad methods are themselves useful functions for their respective instances
20:28 <jle`> if list didn't have a Monad instance, it would probably already define (>>=) and (>>) on its own with different names, just because they're useful
20:28 <jle`> (in fact, list actually does define its own (>>=) under a different name)
20:28 patbecich joined
20:28 <jle`> (not because "oh, we should have monadic bind", but "oh, (>>=) is a useful combinator for lists")
20:28 <Aruro> :t (>>=)
20:28 <lambdabot> Monad m => m a -> (a -> m b) -> m b
20:28 KarboniteKream joined
20:29 <Aruro> [a]->(a->[a])->[a]
20:29 <dolio> I'm not sure how often (>>) for lists comes up.
20:29 <jle`> (>>) for list comes up more often than (>>=), i would think
20:29 <jle`> or just as often
20:29 <dolio> I don't think I agree with that.
20:30 <jle`> for doing prolog-style constraint satisfaction
20:30 <jle`> (>>) is used with guard
20:30 Itkovian joined
20:30 <itachi> you guys now any good resource for quetions on monads?
20:30 <jle`> yes, #haskell :)
20:30 <Aruro> itachi: one definition of monad is revolving around how to get m a out of m (m a) , in terms of lists how to get [a] out of [[a]]
20:31 <itachi> I am questions to solve
20:31 <jle`> dolio: when using list prolog-style, (>>) is essential
20:31 <dolio> Sure. That is already a niche use.
20:31 <Aruro> itachi: dont get stuck with monads, they are just functions.
20:32 <Aruro> nothing special.
20:32 <jle`> dolio: >>= is a niche use too, isn't it?
20:33 <dolio> No. Concat mapping is a frequent operation for building lists in general.
20:33 <itachi> Aruro: k
20:33 HarveyPwca joined
20:33 <jle`> ok you caught me in my bluff
20:35 Kundry_Wag joined
20:35 significance joined
20:37 <jle`> but, (>>) would probably still exist for lists even if there was no Monad instance for some reason.
20:38 <dolio> Yeah, you might occasionally want it.
20:39 arawack joined
20:39 <monochrom> itachi: A textbook is a good source of exercises.
20:40 merijn joined
20:40 om joined
20:40 <rjg_> how can i get a sublist a from a list b such that when you apply the function f to all elements of b, it has a maximum value only on the elements that are also in list a
20:40 <itachi> which textbook? I am currently using http://learnyouahaskell.com/chapters ?
20:40 <monochrom> Exercises take both talent and effort to make. I don't think any bloggers ever bothered.
20:40 <Apocalisp> more mtl questions. Given (r, m a) for some (MonadReader r m), can I run the reader not knowing where in my stack it appears?
20:41 <monochrom> That one is not quite a textbook.
20:41 <itachi> any suggestions on a good textbook?
20:41 replay joined
20:42 <monochrom> There are Richard Bird's textbook, Graham Hutton's textbook, and Chris Allen's haskellbook.com
20:42 <dolio> Apocalisp: No. You could change what parameter is passed in with `local`, though.
20:42 <Aruro> itachi: i suggest no exercises, try to implement very small and personally useful programs, calculating personal day of life, small console utils and so on
20:42 <itachi> k thanks
20:43 <Aruro> itachi: one condition u have to use your programs, more often the better
20:43 <rjg_> so I would like to extend "maximumBy (comparing f) list" so that it can return more than one element in case multiple elements share the maximum value
20:43 <jle`> does anyone know an interesting function :: [a] -> [a] -> [a] that *isn't* associative?
20:43 fizruk joined
20:44 <itachi> Aruro: will do
20:44 <jle`> rjg_: maybe you could gather all of the values into a Map where the keys are the image of f, and the values are the values that gave that image
20:44 <jle`> and then take the value of the maximum key
20:44 <Aruro> itachi: first learn ghci well, commands like :i :t and others, and start playing with every function u can
20:44 <lieven> jle`: if it supports Eq, set difference
20:44 ner0x652 joined
20:44 <jle`> i'm not sure if there's a bettre way, other than writing it using explicit recursion
20:45 <jle`> (which isn't that bad)
20:45 tathougies joined
20:45 <monochrom> jle`: Perhaps an inverse of (++), attempting to strip a prefix.
20:45 <rjg_> thank you
20:45 <nmdanny> is there a way of turning a Traversal' a b into Prism' a b, if I know that the traversal yields only one element?
20:45 <jle`> lieven, monochrom: ah, thanks
20:45 <monochrom> I guess it also needs Eq
20:46 <jle`> oh, yeah, one that doesn't require Eq owould be better for my purpose/demonstration
20:46 <tapirus> > :t (**)
20:46 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
20:46 <Aruro> :t (**)
20:46 <lambdabot> Floating a => a -> a -> a
20:46 <jle`> nmdanny: i don't think so
20:46 <tapirus> ugh, ignore me
20:46 <monochrom> We're basically banking on "the inverse operations such as subtraction and division are not going to be associative" :)
20:46 <robertkennedy> I'm surprised at the number of segfaults I've been getting. Do you guys know which libraries or practices tend to cause them? I'm eyeing wai as the culprit
20:46 <jle`> nmdanny: a prism also has the ability to construct the item
20:47 om left
20:47 <merijn> robertkennedy: Anything using the FFI
20:47 <jle`> nmdanny: there's no way to construct a 'Maybe a' given only a Traversal' (Maybe a) a
20:47 <monochrom> Yikes, even const is associative, eh?
20:47 <jle`> yup it's the zero semigroup
20:47 <jle`> *left zero
20:47 fizruk joined
20:47 <monochrom> Is (\x y -> x ++ y ++ x) good?
20:47 <jle`> well i can just use subtraction
20:48 Itkovian joined
20:48 <merijn> robertkennedy: Any experience debugging C? If it's indeed the FFI (or the runtime system) you might be able to get some useful info from core dumps
20:48 <jle`> treating the list as [()]
20:48 <robertkennedy> merijn: is that pretty much the only case? Do segfaults always blame "generated code"
20:48 <nmdanny> Is there something like the lens traversal that allows modifying the traversable?
20:48 bennofs joined
20:48 <jle`> that is, treating [a] as Nat
20:49 <puregreen> nmdanny: lens traversals already allow modifying the traversable
20:49 <puregreen> > [1,2,3] & each %~ succ
20:49 <nmdanny> do they allow adding or removing elements from it?
20:49 <lambdabot> [2,3,4]
20:49 <monochrom> I would hope that someone will find (\x y -> x ++ y ++ x) or (\x y -> y ++ x ++ y) somewhat useful because that's how "* * * Warning * * *" could be done.
20:49 <puregreen> no, they don't
20:49 <merijn> robertkennedy: Well, they're either compiler bugs, runtime bugs, or people writing bugs using FFI operations. The first is extremely unlikely, runtime (as in, inside the runtime system's C) are very unlikely, but not unheard off. People messing up FFI code? That's as common as people messing up C
20:50 <robertkennedy> I'll try dumping core, but the apps that these pop up in are our wrapping programs, which are pretty large
20:50 <nmdanny> well then is there a similar lens construct? I'm working with a tree-like structure (xml lens),
20:50 <merijn> robertkennedy: I mean, segfaulting is as easy as "peek nullPtr :: IO CInt" :)
20:50 <nmdanny> and I'd like to create a prism for an xml node matching a certain condition
20:50 <puregreen> nmdanny: the only generic thing I know that lets you remove elements from traversed structure is the Witherable class
20:50 <puregreen> no idea about XML, sorry
20:51 <puregreen> if you see a lens that views “Maybe a”, then you should be able to set Nothing to remove the value
20:51 <merijn> robertkennedy: So I suspect FFI in libraries, but if that doesn't appear to be the case, compile with "ghc -debug" which will use the runtime system with DWARF debugging symbols
20:51 <puregreen> but I don't know whether xml-lens has such lenses
20:51 <robertkennedy> Yeah I'll work toward that
20:51 <robertkennedy> Ty
20:52 <nmdanny> well it doesn't have to be necessarily xml-lens, is there a similar abstraction for any tree structure?
20:52 <Aruro> nmdanny: have u looked at hxt?
20:53 <nmdanny> yes, it's what I began with at first
20:53 <nmdanny> and now i'm trying to move to lens
20:53 <puregreen> nmdanny: if xml-lens implements the At class for XML, then you can use `at` from lens to remove values
20:53 <merijn> nmdanny: what kinda xml are you dealing with?
20:53 MrWoohoo joined
20:53 <jle`> ah hm so it looks like subtration (treating [a] as Nat) is not associative
20:54 <nmdanny> i'm creating a utility that would modify an xml tree in place,
20:54 oberstein joined
20:54 <nmdanny> it looks something like this: <ItemContainer><Item></Item><Item></Item><Item></Item></ItemContainer>
20:54 deepfire joined
20:54 <jle`> @let subList [] _ = []; subList xs [] = xs; subList (x:xs) (y:ys) = subList xs ys
20:54 <lambdabot> Defined.
20:54 <jle`> i wonder if this has a name
20:54 Luke joined
20:54 <merijn> nmdanny: no, I meant like: do you need schema support? are you just scraping messy xml? etc.
20:54 <jle`> > subList "abcdefg" [1,2,3]
20:54 <lambdabot> "defg"
20:54 uglyfigurine joined
20:55 <itachi> why does "++ [1,2,3] [4,5,6]" trow an error but not "(++) [1,2,3] [4,5,6]"?
20:55 <nmdanny> the XML has a constant schema, but I don't want to create haskell datatypes for it
20:55 <jle`> itachi: they are different things, heh
20:55 <nmdanny> i'm basically interested in directly manipulating the xml tree
20:55 <jle`> ++ is not the same as (++)
20:55 <merijn> nmdanny: I've had some succes using xml-conduit for scraping
20:55 <nmdanny> that would mean, inserting, replacing and deleting nodes
20:55 <jle`> itachi: ++ is an infix operator, and (++) is a prefix function
20:56 <nmdanny> xml-lens is based on xml-conduit
20:56 <monochrom> [1,2,3] ++ [4,5,6] will not throw an error.
20:56 <jle`> although i can see why you might expect (blah) and blah to be the same
20:56 sypwex joined
20:57 <jle`> btw, in haskell, you can convert any prefix non-operator function into infix, as well, using backticks
20:57 <jle`> > 3 `subtract` 10
20:57 <lambdabot> 7
20:57 <jle`> > 3 `elem [1..10]
20:57 <lambdabot> <hint>:1:9: error: parse error on input ‘[’
20:57 <jle`> > 3 `elem` [1..10]
20:57 <lambdabot> True
20:57 <jle`> so, you can use backticks to turn a non-operator prefix function into infix, and you can use parentheses to turn any operator infix function into prefix
20:57 <monochrom> Unfortunately 3 `(+)` 4 doesn't fly.
20:58 lifter joined
20:58 <itachi> k got it :)
20:58 <Aruro> itachi: try :i (++) in ghci
20:58 <jle`> (`(+)`) 3 4 would have been nice
20:58 <monochrom> lovely bear face or something
20:59 <itachi> "infixr 5 ++" decides the precedence in which it will be used right?
20:59 <monochrom> yes
21:00 zzzq joined
21:00 <monochrom> ("(∨)")
21:01 <Aruro> itachi: btw :i ++ works as expected
21:01 <merijn> on the bright side, GHC ignores the report and allows ಠ_ಠ as identifier :)
21:02 <merijn> See: acme-lookofdisapproval
21:02 bjz joined
21:02 Itkovian joined
21:02 <merijn> A flaw in the report that Haskell Prime will hopefully fix ;)
21:03 <Aruro> so no good april first Haskell news?
21:03 <monochrom> How did the Haskell Report disallow it?
21:04 <merijn> monochrom: Well, you know the unicode bits of the report's syntax? That allow constructors to start with any uppercase letter?
21:04 <monochrom> Yes.
21:05 <merijn> monochrom: They explicitly specified non-constructor identifiers to start with lowercase letters, as opposed to "not uppercase"
21:05 <merijn> monochrom: Now, naively, you'd say those are the same thing. And you'd be wrong ;)
21:05 <monochrom> Oh, there is a middle.
21:05 serendependy joined
21:05 silver joined
21:05 Unicorn_Princess joined
21:05 <merijn> ಠ is a letter from the Kanada writing system, which doesn't have cases and is thus neither upper nor lowercase according to unicode :)
21:06 <merijn> And thus, technically, not a valid identifier
21:06 <monochrom> Yeah, that's too bad. False dichotomies die die die.
21:06 <monochrom> The other die die die false dichotomy is prime vs composite. Causes endless quarrels on 1.
21:07 <merijn> monochrom: Not if we fix the abomination and define 1 to be prime!
21:07 meoblast001 joined
21:07 <monochrom> That would be royally inconvenient.
21:08 fizruk joined
21:09 JoshS joined
21:10 JoshS joined
21:10 Itkovian joined
21:11 JoshS joined
21:11 <Unicorn_Princess> I hope you'll like this: https://my.mixtape.moe/ygcxko.webm
21:13 vydd joined
21:13 vydd joined
21:13 <Aruro> monochrom: wiki tells prime has to be bigger than 1
21:14 sellout- joined
21:14 <Aruro> its needed to exclude ambiguity in factorization
21:15 <rjg_> does the output of trace (and its derivates) go to stdout or stderr?
21:15 <jle`> i know a way to find out
21:16 coot joined
21:16 <nmdanny> is it possible to do in-place manipulation of XML trees with xml-conduit?
21:16 <nmdanny> with their cursor interface^
21:16 <monochrom> You are like me. When someone here asks "why is f x y parsed as (f x) y?", I shallowly answer "because Haskell 2010 says so", evading the real question of why the Haskell designers designed it so.
21:17 uglyfigurine joined
21:17 <monochrom> It is very leisurely to just cite authority and never critically think about it.
21:17 azahi joined
21:18 jao joined
21:18 <monochrom> And even unique factorization does not explain why don't we classify 1 as a composite.
21:19 cmsmcq__ joined
21:22 <Aruro> i cited modern source, no dichotomy
21:22 <Aruro> prime Has to be bigger than 1, problem solved?
21:22 <dmj`> what was the max # of fields a haskell record can have?
21:22 splanch joined
21:23 ragepanda joined
21:23 <monochrom> I think it's up to individual compilers.
21:23 <merijn> dmj`: According to the spec? I don't think there's a limit. According to GHC? Several tens, because after that (well, even before that) compile time blows up
21:23 <monochrom> I think GHC's is around 64 +/- 1 or something.
21:24 <merijn> For tuples, yes. Not sure if that holds for ADTs, though?
21:24 <Unicorn_Princess> why would nb. of fields explode compile times? :S
21:24 <monochrom> Oh! Right, I don't know.
21:24 peterbecich joined
21:24 <merijn> Unicorn_Princess: I'm not ruling out some Shlemiel the Painter algorithm somewhere
21:24 <monochrom> Type inference time is exponential to program length.
21:25 Jesin joined
21:25 <merijn> monochrom: Naah, it's because it blows up the memory GHC uses, resulting in lots of swapping
21:26 <merijn> monochrom: There's this pandoc dependency for bibtex stuff that has one or two ADTs with huge number of fields, and in 7.6/7.8 compiling that would balloon to comical (if you didn't care about actually finishing >.>) sizes
21:26 zcourts joined
21:26 <monochrom> OK, I suppose it is just space in the case of long tuples or products.
21:27 sssilver joined
21:27 <merijn> ugh...I hate it when I'm required to think to write my code >.<
21:29 fotonzade joined
21:29 <monochrom> You don't think to walk, only because you have walked so many thousands of hours.
21:29 <monochrom> So write more code. Keep writing until you don't need to think anymore.
21:30 <merijn> monochrom: That only works if you keep writing code at the same difficulty level :p
21:30 Itkovian joined
21:31 <monochrom> Yeah, well, First World problems.
21:33 Rainb joined
21:33 e0d1n joined
21:35 aglorei1 joined
21:35 darjeeling_ joined
21:35 tomboy64 joined
21:35 Kundry_Wag joined
21:39 cdg joined
21:42 <sophiag> what does SrcLoc mean in ASTs?
21:42 <merijn> sophiag: The location in the source where said part was defined? :)
21:43 <sophiag> ha
21:43 <sophiag> the context is in lambdas so i assume it uses the location sort of as a var to distinguish between them
21:44 begriffs joined
21:44 <merijn> sophiag: No, I would expect it to be the source code line that defined the lambda
21:45 <sophiag> yeah. because it's "1-1" in ghci :)
21:45 Itkovian joined
21:46 johnw_ joined
21:48 Unhammer joined
21:49 jmorris joined
21:50 <geekosaur> it's mostly there to show locations in error messages
21:50 grafoo joined
21:50 acidjnk joined
21:50 <sophiag> i was curious because i'm trying to construct one and can't find it in the docs
21:51 <koala_man> zsh
21:51 <koala_man> derp
21:52 hiratara joined
21:52 albertus1 joined
21:53 grafoo left
21:54 grafoo joined
21:54 Achylles joined
21:56 dzdcnfzd joined
21:56 <dzdcnfzd> Does anyone have any idea why stack might be failing to install aeson-1.0.2.1? The message is Rule "FromJSONKeyCoerce: fmap id" may never fire because ‘id’ might inline first Probable fix: add an INLINE[n] or NOINLINE[n] pragma for ‘id’
21:58 <dzdcnfzd> And, just generally, I can't figure out how to trouble-shoot this sort of thing
21:59 coot joined
22:02 forgottenone joined
22:04 oisdk joined
22:05 marcopullo joined
22:08 ystael joined
22:09 mjhoy joined
22:11 deepfire joined
22:12 <bennofs> dzdcnfzd: this sounds like it should be a warning, not an error to me?
22:12 vimto joined
22:15 mac10688 joined
22:15 <dzdcnfzd> bennofs: http://lpaste.net/354158
22:15 <dzdcnfzd> am I missing something
22:18 hololeap joined
22:20 splanch joined
22:22 eschnett joined
22:23 boombanana joined
22:23 louispan joined
22:24 zcourts_ joined
22:25 skeuomorf joined
22:26 coot_ joined
22:26 zcourts__ joined
22:27 anuxivm joined
22:29 jao joined
22:31 <geekosaur> uhhhhh
22:31 <geekosaur> ExitFailure (-11) has a rather high chance of being the compiler segfaulted
22:31 zzzq joined
22:31 hiratara joined
22:32 <dzdcnfzd> geekosaur: whoa
22:32 <dzdcnfzd> is there any fix for that?
22:32 Einwq joined
22:33 sportanova joined
22:33 <ggVGc> don't write software
22:33 <geekosaur> https://github.com/commercialhaskell/stack/issues/2575 looks related
22:33 <ggVGc> ^ fixes all bugs
22:34 <geekosaur> it suggests the real problem is out of swap and it showed up as a segfault probably because of the new memory allocator not handling that well?
22:34 <ggVGc> geekosaur: please explain to me if haskell is so good, and the compiler is written in haskell, then how can the compiler break?
22:34 <ggVGc> :(
22:35 <geekosaur> (more specifically, I'd guess someone did not consider that an allocation failure, the way they are doing it, probably *will* show up as a segfault)
22:36 zariuq joined
22:36 napping left
22:36 <geekosaur> (there is no guarantee you get back success/failure from the madvise() call, actual page allocation may not happen until it's first written to and if it fails you take a segfault...)
22:36 zargoertzel joined
22:37 <MarcelineVQ> dzdcnfzd: what version of stack do you have
22:38 <geekosaur> oh, and nobody would likely have caught that failure mode because often the OOM killer will trigger first, but if it doesn't then you get a segfault. wonder if that should be reported...
22:39 <geekosaur> hah, I didn't finish reading the bug, it's already reported. will comment
22:42 Rodya_ joined
22:44 coot joined
22:44 coot joined
22:44 bjz joined
22:44 <sophiag> geekosaur: i'm still stuck on this data type for storing lambdas =(
22:45 <* geekosaur> updates ghc bug report
22:45 <geekosaur> not sure I can help, to be honest
22:45 <MarcelineVQ> but was it ghc that error 11'd or stack
22:46 <geekosaur> stack was running to report the ExitFailure
22:46 <geekosaur> so it would have been ghc
22:47 <sophiag> my issue is just with the types at this point :/
22:47 <MarcelineVQ> geekosaur: sounds reasonable
22:48 ludat joined
22:49 <geekosaur> sophiag, the problem is, it's not "just" the type; the way you were trying to do it, there's no way to assign a type to it without causing other problems.
22:49 <geekosaur> (Like, you can hide it in an existential, but then you can't do anything with it.)
22:49 <geekosaur> (including match it with other types)
22:50 <sophiag> actually if i *could* hide it in an existential i'd be fine. i can't because it needs an Eq constraint
22:50 <tobiasBora> srhb: Ok thank you!
22:51 Noldorin joined
22:53 johnw_ joined
22:53 thimoteus joined
22:53 zariuq joined
22:54 emmanuel_erc joined
22:55 zargoertzel joined
22:55 Kundry_Wag joined
22:55 mmachenry joined
22:58 oisdk joined
23:00 louispan joined
23:00 MindlessDrone joined
23:01 z3r0 joined
23:02 fizbin joined
23:02 dawehner joined
23:02 dfeuer joined
23:02 fadeway_ joined
23:03 eacameron joined
23:04 meba joined
23:06 sportanova joined
23:07 oisdk joined
23:08 sportano_ joined
23:09 hackebeilchen1 joined
23:10 fakenerd joined
23:12 silver joined
23:15 freeside joined
23:16 splanch joined
23:21 theDon_ joined
23:22 tromp joined
23:22 splanch joined
23:23 oisdk_ joined
23:23 worch joined
23:24 b_perez_ joined
23:25 markus1209 joined
23:25 markus1219 joined
23:25 nakal_ joined
23:26 <b_perez_> is there way to get polymorphic type info from reify in TH? For example, lets say I have some Exp with type Maybe String and I want to use reify to see if its a member of Maybe a
23:28 <b_perez_> In other words, I want to catch all expressions in some function declaration that are in some monad m using TH
23:29 <lyxia> You can just check the type constructor
23:31 systadmin joined
23:32 <b_perez_> so just pattern match and make sure it starts with an IO constructor and add some extra stuff to make sure its not like IO String -> IO () or whatever?
23:33 <lyxia> If it "starts with" IO it can't be a function.
23:34 <lyxia> IO String -> IO () has (->) as the constructor at the root. IO String has IO.
23:34 mizu_no_oto_work joined
23:34 <b_perez_> right right
23:34 <b_perez_> thanks!
23:34 <lyxia> yw
23:35 permegreen joined
23:36 anuxivm left
23:38 Welkin joined
23:40 pyx joined
23:43 sportanova joined
23:45 jmiven joined
23:46 permagreen joined
23:47 darjeeling_ joined
23:52 jsgrant joined
23:56 Shatnerz0 joined
23:59 <mjhoy> maybe a stupid question; why is Network.Wreq.get :: String -> IO (Response BSL.ByteString) and not something like String -> IO (Either HttpException (Response BSL.ByteString))
23:59 dan_f joined