<    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:12 splanch joined
00:21 animated joined
00:38 splanch joined
00:39 NoCreativity joined
00:48 emmanuel_erc joined
00:50 \Mike joined
00:51 Rodya_ joined
00:54 conal joined
00:55 NoCreativity_ joined
01:00 hoffmeyer joined
01:01 taksuyu joined
01:10 aarvar joined
01:12 [k- joined
01:15 splanch joined
01:22 peterbec` joined
01:23 hphuoc25 joined
01:26 emmanuel_erc joined
01:31 [k-_ joined
01:31 aarvar joined
01:34 dni- joined
01:36 takle joined
02:01 hoffmeyer joined
02:08 systemfault joined
02:14 mac10688 joined
02:19 <qmm> why does drop 2 (enumFromTo 10 (20 :: Integer)) result in [12,13,14,15,16,17,18,19,20] ?
02:20 <benzrf> qmm: what would you expect it to result in?
02:20 <qmm> > enumFromTo 10 (20 :: Integer)
02:20 <lambdabot> [10,11,12,13,14,15,16,17,18,19,20]
02:20 <qmm> > drop 2 [1..5]
02:20 <lambdabot> [3,4,5]
02:21 <geekosaur> > drop 2 [10..20]
02:21 <lambdabot> [12,13,14,15,16,17,18,19,20]
02:21 takle joined
02:21 <qmm> i would expect the result to be that
02:21 <qmm> oh, it is that... i must be tired
02:21 <geekosaur> huh?
02:21 <qmm> sorry about this
02:22 exferenceBot joined
02:23 peterbec` joined
02:26 <qmm> i shouldn't be asking questions while i'm tired, but i do have one more question
02:26 <qmm> > dropWhile (>6) [1..10]
02:26 <lambdabot> [1,2,3,4,5,6,7,8,9,10]
02:26 <qmm> why does it return the list?
02:26 <qmm> the entire list
02:26 <MarcelineVQ> 1 isn't greater than 6 so it stops dropping
02:27 <qmm> good enough then :)
02:27 <qmm> thanks MarcelineVQ
02:27 hexagoxel joined
02:33 conal joined
02:34 takle joined
02:35 eacameron joined
02:35 strixy joined
02:37 justicefries left
02:41 takle joined
03:02 hoffmeyer joined
03:03 diminishedprime joined
03:09 takle joined
03:15 splanch joined
03:19 <qmm> and another
03:19 <qmm> why is (1,2) weak head normal form and normal form but "papu" ++ "chon" is neither
03:20 <geekosaur> because (,) is a constructor but (++) is a function
03:22 <qmm> \x -> x * 10 is whnf and nf
03:22 <qmm> it's a function
03:22 <qmm> also, thanks geekosaur for taking the time to respond
03:22 takle joined
03:22 nocookies92 joined
03:22 <geekosaur> so, (++) can be expanded further by substituting its definition, but none of (,), 1, or 2 can be expanded further. as for the lambda, it is as expanded as it can get without applying it
03:22 dni- joined
03:24 hphuoc25 joined
03:24 <qmm> :t "papu" ++ "chon"
03:24 <lambdabot> [Char]
03:24 <qmm> i guess that's the part that is confusing to me
03:24 peterbec` joined
03:25 <geekosaur> NF and WHNF have to do with evaluation. types can be determined without evaluation
03:25 <geekosaur> :t 1 + undefined
03:25 <lambdabot> Num a => a
03:25 <qmm> my curent intuition is that [Char] looks like normal form
03:25 <qmm> that's why i was confused
03:26 <qmm> thanks again
03:26 <glguy> [Char] is a type
03:26 <geekosaur> it's normal form on the type level, but that has nothing to do with the value level
03:26 <glguy> it's not related to WHNF
03:26 <qmm> geekosaur: do you use haskell at work?
03:26 <qmm> you should
03:26 <geekosaur> no, sadly. I maintain a big ugly chunk of C code most of which lives in the kernel
03:27 eacameron joined
03:28 hphuoc25 joined
03:45 sieve111 joined
03:48 vaibhavsagar joined
03:49 takle joined
03:49 splanch joined
03:49 <sieve111> Hi, I am trying to implement Sundaram's Sieve and I am running into some hiccups with the compiler. Here's a paste of my code http://lpaste.net/3541666797201653760
03:50 <sieve111> I am having trouble figuring out the error message since I try and test out what the compiler is complaining about, but it gives me no errors
03:50 <Cale> sieve111: Perhaps you want half n = n `div` 2
03:50 conal joined
03:51 <sieve111> lol, why did that fix my problem?
03:51 <sieve111> Cale: thank you, though
03:51 <Cale> It's complaining because in order to divide using (/) the numbers have to be of a type capable of representing fractions, of which Integer is not.
03:52 <sieve111> Why does ghci let me get away with this?
03:53 <Cale> Did you use numerical constants like 5?
03:53 <sieve111> (that was rhetorical)
03:53 <sieve111> yes
03:53 <Cale> 5 is polymorphic
03:53 <Cale> :t 5
03:53 <lambdabot> Num t => t
03:53 <sieve111> oh
03:53 <sieve111> thanks for pointing that out
03:54 <sieve111> That answers my question then
03:54 <Cale> :t 4.5
03:54 <lambdabot> Fractional t => t
03:54 <Cale> :t pi
03:54 <lambdabot> Floating a => a
03:56 <Cale> Num is satisfied by basically any numerical type, Fractional means you can take multiplicative inverses and do division with (/), Rational fits there along with the usual floating point types, Floating gives you functions like exp and log and trig functions and pi, and is satisfied by Float and Double and stuff like Complex Double
03:57 splanch joined
03:57 <Cale> RealFrac has a bunch of rounding-related stuff such as floor, and it basically excludes complex numbers.
04:01 <sieve111> Thank you for the overview
04:03 hoffmeyer joined
04:06 Gurkenglas_ joined
04:10 takle joined
04:10 AppleJacks24 joined
04:17 moei joined
04:20 takle joined
04:24 gspia joined
04:25 peterbec` joined
04:26 <lpaste_> mac10688 pasted “Parse error on print minimum” at http://lpaste.net/354048
04:26 <mac10688> anyone know why there is a parse error for print minimum?
04:27 <glguy> mac10688: You're missing a 'do' inside your 'then' expression
04:28 <mac10688> oh ok
04:29 <mac10688> ok I think I get that. the if statement is like a line in the original statement.
04:29 takle joined
04:29 <mac10688> Thanks glguy
04:29 <mac10688> +1 glguy
04:29 <glguy> Right, the if-then-else is just a normal expression, it's not special-cased for do-notation
04:33 <mac10688> I'm working on codeingame problems. I just submitted that and the best answer is really slick. I still have much to learn
04:35 shayan_ joined
04:35 <lpaste_> mac10688 pasted “Better answer” at http://lpaste.net/354049
04:35 <mac10688> That's a much slicker answer than mine
04:36 <mac10688> I'll get there one day
04:37 takle joined
04:49 takle joined
04:56 NeverDie joined
04:57 takle joined
05:03 hoffmeyer joined
05:06 kmic joined
05:08 splanch joined
05:11 splanch_ joined
05:12 dni- joined
05:14 uglyfigurine joined
05:15 takle joined
05:17 enitiz joined
05:23 takle joined
05:25 meandi_2 joined
05:26 peterbec` joined
05:39 scared1 joined
05:39 gpampara- joined
05:44 takle joined
05:44 animated joined
05:51 rlpowell joined
05:55 permegreen joined
05:58 ThomasLocke joined
05:58 takle joined
06:04 hoffmeyer joined
06:15 Pupnik joined
06:27 Sose joined
06:27 peterbec` joined
06:29 kritzcreek_ joined
06:29 permagreen joined
06:32 hphuoc25 joined
06:41 dni- joined
06:44 patbecich joined
06:46 eacameron joined
06:48 yellowj joined
06:50 eacamero_ joined
06:50 takle joined
06:54 patbecich joined
06:56 vitalij joined
06:57 hphuoc25_ joined
06:57 nacon joined
06:57 nacon joined
06:58 <vitalij> Hi everybody! Can anyone please help me with this Yesod problem? http://stackoverflow.com/questions/43080647/yesod-database-migration-loop
06:59 mattyw joined
06:59 takle joined
07:01 splanch joined
07:02 nick_h joined
07:05 hoffmeyer joined
07:06 slomo joined
07:06 thc202 joined
07:07 takle joined
07:17 grayjoc joined
07:19 jmorris joined
07:25 uglyfigurine joined
07:28 peterbec` joined
07:32 salva0 joined
07:35 eacameron joined
07:43 jmiven joined
07:45 merijn joined
07:52 takle joined
07:56 patbecich joined
07:56 hdeshev joined
07:58 galderz joined
08:02 hphuoc25 joined
08:03 splanch joined
08:04 Durz0 joined
08:06 hoffmeyer joined
08:08 splanch joined
08:11 salva0 joined
08:13 takle joined
08:19 splanch joined
08:20 galderz joined
08:26 nokomo joined
08:28 grdryn joined
08:29 mattyw joined
08:29 peterbec` joined
08:29 Glooomy joined
08:30 hphuoc25 joined
08:32 takle joined
08:34 eacameron joined
08:51 zero_byte joined
08:56 takle joined
08:57 patbecich joined
09:05 ngWalrus left
09:06 takle joined
09:06 hoffmeyer joined
09:11 louispan joined
09:15 eacameron joined
09:15 takle joined
09:24 takle joined
09:25 zero_byte joined
09:28 grayjoc joined
09:30 peterbec` joined
09:32 sigmundv_ joined
09:35 Ferdirand joined
09:35 takle joined
09:35 uglyfigurine joined
09:37 splanch joined
09:40 NeverDie_ joined
09:41 NeverDie joined
09:42 merijn joined
09:46 __rgn joined
09:46 <__rgn> > We can think of a value of type IO as an action that takes as its argument the current state of the world, and will return a new world where the state has been changed according to the function's return value.
09:46 <lambdabot> <hint>:1:14: error: parse error on input ‘of’
09:46 cur8or joined
09:46 <__rgn> is there an error in this sentence?
09:46 <__rgn> how does "value" take an argument
09:46 <__rgn> should it be function
09:47 <jle`> functions in haskell are values
09:47 <merijn> __rgn: Well, it's a *terrible* explanation that you should immediately forgot, btw
09:47 <jle`> the entire sentence's point is an error, but yeah, functions in haskell are values
09:48 <jle`> 'negate :: Int -> Int' is a value of type Int -> Int
09:48 <merijn> I think "functional programming" is a misnomer, we should call it "Value Oriented Programming" :)
09:48 <__rgn> so it's better to talk about values than functions
09:49 <jle`> it's not necessarily one or the other
09:49 <jle`> i'm not really sure what that would mean, anyway
09:50 <merijn> __rgn: I usually like to explain "IO a" as "a program fragment that, when executed, produces an 'a'"
09:50 <jle`> that's like saying it's better to talk about rectangles than squares
09:51 <__rgn> if we talk about values that take arguments, why does it not make sense to talk about functions?
09:52 <merijn> __rgn: jle` is saying 'all functions are values, not all values are functions'
09:52 <__rgn> i'm aware of that
09:52 <jle`> __rgn: i'm not sure what you are asking...it makes sense to talk about functions and values
09:52 <merijn> It makes sense to talk about functions, is just that calling "IO a" a function is a terrible idea :)
09:52 <jle`> those are both meaningful and useful concepts/things
09:54 colt44 joined
09:54 takle joined
09:54 <__rgn> "IO a" doesn't look like a function to me, "IO a -> IO b" does
09:54 <merijn> __rgn: Right
09:54 <Akii> hm I've an infinite stream of events (they're also being produced) and several different folds on those events. How would I go about composing those folds and get like intermediate results?
09:55 gregman_ joined
09:57 <merijn> __rgn: Well, I think you misunderstood what the original text was saying, which is fine since what it was saying was bad anyway :)
09:57 <__rgn> what was the original text saying then?
09:57 <jle`> __rgn: the statement you gave earlier is trying to say that you can think of IO as representing a function
09:58 <jle`> not that its type is literally a function type
09:58 <merijn> __rgn: That you could think of "IO a" as "RealWorld -> (a, RealWorld)" or something
09:58 <jle`> (not that i agree with its point)
10:02 uglyfigurine joined
10:03 tdf joined
10:05 <sudoreboot[m]> "In Haskell, everything is a function" is a common saying. So it's basically a common misconception?
10:06 <merijn> sudoreboot[m]: Yes!
10:06 <kadoban> sudoreboot[m]: Yes. Not everything is a function.
10:06 <merijn> sudoreboot[m]: See: http://conal.net/blog/posts/everything-is-a-function-in-haskell
10:07 <sudoreboot[m]> Great info, thanks
10:07 hoffmeyer joined
10:07 <jle`> it's literally false, heh
10:08 <jle`> but the article does break down a lot of reasons why the misconception might have arose
10:16 <__rgn> wrt. "pointed functor", what does pointed mean?
10:16 NeverDie joined
10:18 <__rgn> i understand what those are, but why "pointed"
10:30 Glooomy joined
10:31 peterbec` joined
10:35 netheranthem joined
10:37 hphuoc25 joined
10:48 colt44 joined
10:48 m1dnight_ joined
10:49 galderz joined
10:53 m1dnight1 joined
11:06 <Akii> o m g, this pipes stuff is amazing
11:07 hphuoc25 joined
11:08 hoffmeyer joined
11:13 Ferdirand joined
11:13 splanch joined
11:19 pbrant joined
11:26 splanch joined
11:27 grayjoc joined
11:30 splanch joined
11:32 peterbec` joined
11:38 conmaxo joined
11:41 yellowj joined
11:43 conmaxo left
11:43 hphuoc25 joined
11:45 splanch joined
11:45 snowcrshd joined
11:46 splanch_ joined
11:47 merijn joined
12:06 miguel_fontes joined
12:09 hoffmeyer joined
12:10 ederign joined
12:22 pbrant_ joined
12:24 eacameron joined
12:24 hoffmeyer joined
12:33 peterbec` joined
12:39 ExpHP joined
12:40 NoCreativity joined
12:42 kritzcreek_ joined
12:56 hphuoc25 joined
12:56 netheranthem joined
13:07 splanch joined
13:14 nitrix_ joined
13:17 carlomagno joined
13:24 <Akii> is it possible to write a producer like this: `Producer a m () -> Producer b m () -> Producer (Either a b) m ()`?
13:26 <merijn> Akii: Well, how would you expect it to alternate?
13:27 <Akii> depending on which producer comes first
13:27 <merijn> Akii: Well, that doesn't make sense in pipes, since they're coroutines :)
13:27 <merijn> Akii: They're basically transformed into callbacks, so there is no "first"
13:27 <merijn> Akii: It needs to, statically, know which producer returns first
13:27 <Akii> so no way of merging two producers?
13:28 <merijn> Akii: You might be able to do it using pipes-concurrency
13:28 Denthir joined
13:29 <Akii> I need merging and multiple consumers
13:29 <merijn> Akii: Right, merging and multiple consumers is what pipes-concurrency does :)
13:29 <Akii> guess I'll have to immediately check out pipes-concurrency then
13:29 <Akii> nice
13:30 <Akii> already got producers for events from my event store
13:30 <Akii> just got to wire them up now :D
13:30 <Akii> it'sa mee mario
13:31 dni- joined
13:31 <merijn> Akii: Basically, I think you want to transform one producer by having "Pipe a (Either a b) m ()" and "Pipe b (Either a b) m ()", then feed both of those into a pipes-concurrency mailbox and have people read from there
13:32 prophile joined
13:34 peterbec` joined
13:35 ExpHP_ joined
13:37 <Akii> merijn: thought about that as well, but as you said: merging/splitting only works with concurrent pipes
13:37 <Akii> checking that out now :D thanks!
13:40 chlong joined
13:44 pbrant_ joined
13:48 takle joined
13:48 hphuoc25 joined
13:50 mizu_no_oto_work joined
13:52 Rodya_ joined
13:54 nitrix_ joined
14:03 louispan joined
14:04 Miroboru joined
14:08 takle joined
14:08 conal joined
14:10 eacameron joined
14:10 hphuoc25 joined
14:12 eacamero_ joined
14:12 meandi joined
14:14 eacamer__ joined
14:18 eacameron joined
14:20 eacamero_ joined
14:20 Denthir joined
14:22 splanch joined
14:30 grayjoc joined
14:35 takle joined
14:36 peterbec` joined
14:37 nil_ joined
14:37 ekinmur joined
14:43 mizu_no_oto_work joined
14:45 <nil_> @def newtype Zero a = Zero ()
14:45 <lambdabot> Defined.
14:47 <nil_> Is it true that ((f is a Functor) and (f is a Contravariant)) => f ≅ Zero ?
14:50 <hexagoxel> Zero ≅ Proxy, btw
14:52 <nil_> hexagoxel: ah, cool. So is it the only such type?
14:52 <__rgn> why is fmap function composition for functor instance of function? and what is `((->) c)` trying to say, a function that takes c as argument?
14:52 <hexagoxel> i am not sure, sorry. was not meant as an answer.
14:53 <geekosaur> __rgn, ((->) c) is partial application of (->), written as a prefix function because section syntax doesn't work for (->)
14:53 <geekosaur> put otherwise: ((->) c) is (c -> _) where _ has been left unspecified
14:54 <geekosaur> (because it's supplied by the Functor class)
14:55 <__rgn> :type (->) doesn't work
14:55 <Gurkenglas_> nil_, every f that is a Functor and a Contravariant is isomorphic to some Const a
14:56 <__rgn> but :kind (->) does
14:56 <Gurkenglas_> (And all Const a are Functor and Contravariant)
14:56 <geekosaur> nil_, https://www.schoolofhaskell.com/user/commercial/content/covariance-contravariance might be of interest
14:56 <nil_> Gurkenglas_: hmm, and Proxy (== Zero) is a kind of Const a where a = ()?
14:57 <Gurkenglas_> Yep
14:57 <nil_> Awesomage.
14:58 <geekosaur> __rgn, yes, because (->) is used in types, not in values
14:58 <nil_> What are other examples of pairs of typeclasses that define a single type that satisfies both?
14:58 <geekosaur> (at value level -> is used only syntactically, for example in case expr of { pattern -> expr })
14:59 <geekosaur> (or lambdas)
14:59 <Gurkenglas_> You might be interested in Distributive, every instance of which is isomorphic to ((->) r) for some r
15:00 Big_G joined
15:01 <Gurkenglas_> Or Comonoid which isn't in a library because every instance of it is trivial
15:01 <nil_> Where can I find Comonoid?
15:02 <Gurkenglas_> I just said that it isn't in a library :P
15:02 <Gurkenglas_> class Comonoid m where comempty :: m -> (); comappend :: m -> (m, m)
15:02 <__rgn> so why's fmap for functions composition. i've learned to think of functors are containers and it doesn't really make sense here i suppose
15:03 <nil_> Gurkenglas_: hmm, I almost invented these once on my way back home from work.
15:03 uglyfigurine joined
15:03 <Gurkenglas_> You can think of functions as containers that have a slot for every value of the domain
15:04 MitchellSalad joined
15:04 Denthir joined
15:04 <Gurkenglas_> Bool -> Int is like (Int, Int)
15:04 <nil_> Sure, I grok that well enough.
15:05 earldouglas joined
15:05 <Gurkenglas_> That was to __rgn, who was looking for a way to grok ((->) r)'s Functor instance
15:05 <nil_> Oh :>
15:05 <* geekosaur> thinks maybe thinking of Functors as containers is not such a good idea
15:05 <Gurkenglas_> What Functor cannot be thought of as a container with enough twists in one's neurons?
15:06 <nil_> Metaphors in general are usually a shaky idea.
15:06 <nil_> ...Void is hardly a container imo.
15:07 <__rgn> how is Bool -> Int like (Int, Int)
15:07 <geekosaur> Proxy. IO. (you can probably twist both but you will pay for it because nothing else will make sense)
15:07 <__rgn> oh (Int, Int) is set of possible values
15:08 <nil_> (Oops, Void has kind *, ignore that one :>)
15:08 <Gurkenglas_> Proxy is as much a container as the empty set is a set
15:08 <Gurkenglas_> I'll give you IO, and State s for that matter
15:09 joneshf-laptop joined
15:09 <hrnz> how is the tensor product a container?
15:09 <hrnz> or dual spaces
15:09 <Gurkenglas_> um translate to haskell pls ._.
15:10 <Akii> whee this is fun http://lpaste.net/354058
15:10 <hrnz> *shrug*
15:10 <Cale> __rgn: You can think of a function A -> B as a container filled with values of type B, indexed by values of type A
15:10 <Cale> __rgn: and then the functor instance will make sense
15:11 hphuoc25 joined
15:11 <Cale> Of course, once you get to more complicated types of computations, the container analogy isn't always an ideal way of understanding, but there's always some way to make it work like that.
15:11 <Gurkenglas_> Akii, I feel like that should be MonadState s m0 instead
15:12 <Cale> __rgn: another way to understand it is just to look at the types involved and realise that it's the only reasonable option
15:12 <Gurkenglas_> Cale, make State s work like that
15:12 <Akii> Gurkenglas_: that would get rid of the IORef
15:12 <Cale> Gurkenglas_: sure... in order to do so, we can represent it as a free monad:
15:13 <Akii> Gurkenglas_: but no idea how I'd use the pipe then
15:13 <Cale> data State s a = Done a | Put s (State s a) | Get (s -> State s a)
15:14 <__rgn> so it's like a container of possible values for a function, and when you fmap it the possible values change because of composition
15:14 <Cale> and now State s a values look like trees of values of type a, with branch nodes having children indexed by values of type s
15:14 <Cale> __rgn: Yeah, you can think of a function as being like a giant (possibly infinite) array
15:15 <Cale> If our function is f :: A -> B then the value at index i :: A is then f i :: B
15:16 <Akii> http://lpaste.net/354059 anyone? xD
15:16 <Akii> I'm easily amused, carry on
15:17 Glooomy joined
15:20 dni- joined
15:21 <Akii> Gurkenglas_: now I get it
15:21 <Akii> nope, can't do that (I think)
15:21 <Akii> but since the IORef has a very limited scope I think it's ok
15:21 Haruna joined
15:21 Haruna joined
15:22 Rodya_ joined
15:26 <__rgn> what is the relationship of ((->) r) functor instance and so called "reader functor"
15:26 <nil_> Lots of Traversable instances use "pure" inside to define "traverse". Applicative is not a superclass of Traversable though. How does that work? Where does "pure" come from?
15:27 <geekosaur> __rgn, Reader is just a newtype over ((->) r)
15:30 <geekosaur> nil_, the Traversable itself does not need Applicative, but Traversable methods are used to map Applicatives (or Monads) over the Traversable
15:30 NoCreativity joined
15:31 <nil_> Ah, right, the type of "traversable" says as much.
15:31 <nil_> Thanks
15:31 <nil_> s/traversable/traverse/
15:32 gtd joined
15:37 peterbec` joined
15:44 for{} joined
15:44 <for{}> hi
15:44 <for{}> using hoogle, can i search for a word in extended information?
15:45 <for{}> i dont wanna search only in the name of functions/modules etc. id like to seach in extended information too
15:46 <for{}> for example how can i find which function extract the first component of a pair?
15:46 <for{}> is there a smart way to figure out?
15:48 zero_byte joined
15:48 <tuturto> for{}: you can search for (a, b) -> a
15:50 <for{}> this is the smartest i can go?
15:50 <tuturto> that's the smartest I know, which probably isn't the smartest
15:50 <for{}> tuturto, are there clever, more enhanced alternatives to hoogle?
15:51 <for{}> im a total noob
15:51 <tuturto> for{}: not that I know, but I don't know much about haskell
15:52 <tuturto> just trying to find my way with it
15:52 <for{}> i think some guys designed haskell while other guys made ghc and after that other guys made hoogle
15:55 <tuturto> it usually works out with hoogle when you try to search with function signature
15:57 <for{}> thanks, tuturto
15:57 <tuturto> hopefully that helped at least a bit
15:57 <tuturto> like I said, I'm new to haskell too
15:58 <for{}> do you find yourself often using hoogle?
15:58 inerkick joined
15:59 <tuturto> every time I don't know what function to use
15:59 <tuturto> that's where I start
16:00 <for{}> in a perfect world, would we still need haskell?
16:00 NoCreativity joined
16:01 <tuturto> I guess it would depend on the perfect world
16:01 <tuturto> :D
16:02 mounty joined
16:02 <tuturto> it's fun language
16:02 <tuturto> with plenty of good ideas
16:02 <for{}> i mean in a perfect world, imperative programming flaws wouldnt have the effects it has in our world
16:02 <Akii> in a perfect world there would be no problems to solve, hence no programs required
16:04 <tuturto> but wouldn't that be boring, if there weren't any problems to solve or questions to answer? so it wouldn't be a perfect world?
16:04 <for{}> from what i read, haskell does its best to stop you from shooting yourself
16:06 <Akii> unless you unsafePerformIO the gun
16:11 <lpaste_> wamaral pasted “The first test fails sometimes, ex: with `1.0e-2`, the other 2 pass everytime” at http://lpaste.net/354063
16:12 <wamaral> I'm not sure I'm doing this quickcheck thing right, to be honest
16:13 <wamaral> I can't get a wrong result on the repl either
16:14 <wamaral> Any clue on why it might fail is appreciated :)
16:15 m1dnight_ joined
16:15 conal joined
16:18 <for{}> does haskell community grow?
16:19 <Akii> yes
16:24 <Akii> statefulP' :: Monad m => s -> Pipe (s,ev) s m r -> Pipe ev s m r
16:24 <Akii> is there a way to get both `s` and `r` from the second argument?
16:25 <Akii> if so I could just (maybe) make the whole state handling effect free, so to say
16:30 splanch joined
16:37 pilne joined
16:39 peterbec` joined
16:39 WarmCookie left
16:40 WarmCookie joined
16:40 <* WarmCookie> bites Akii, not telling who he is.
16:40 <Akii> nooo
16:40 <WarmCookie> :3
16:40 <Akii> in soviet russia akii bites you!
16:42 <Akii> there, that showed him
16:44 t0by joined
16:44 t0by joined
16:44 Rodya_ joined
16:48 gtd joined
16:52 zerokarmaleft joined
16:55 jathan joined
16:57 <glguy> http://imgur.com/a/ZrYFl
16:57 <Geekingfrog> quit
16:57 <glguy> Not that it was a secret, but I wasn't following closely
17:03 Ferdirand joined
17:04 <Akii> glguy: I figured it could only be one person
17:04 <Akii> thanks for confirming
17:08 myrkraverk joined
17:09 malaclyps joined
17:09 <__rgn> any specific resources you would recommend to get a better understanding of Reader?
17:10 dpren joined
17:15 <glguy> __rgn: Reader is just another name for (->), the type of functions. You might start by looking at the implementations of Functor, Applicative, and Monad on functions: http://hackage.haskell.org/package/base-
17:19 animated joined
17:20 Rodya_ joined
17:31 pbrant joined
17:32 nil_ joined
17:32 earldouglas joined
17:34 NoCreativity joined
17:35 yellowj joined
17:36 Big_G joined
17:36 <__rgn> yeah but I find `ask` `runReader` etc. a big confusing
17:37 <__rgn> bit*
17:39 hoffmeyer joined
17:39 bt12 joined
17:42 splanch joined
17:49 hoffmeyer joined
17:53 <glguy> ask is another name for id
17:53 <glguy> ask x = x
17:55 marvin2 joined
17:55 poohflapz joined
17:56 dni- joined
17:58 malaclyps joined
17:58 chlong joined
18:00 mizu_no_oto_work joined
18:10 albertus1 joined
18:22 chlong joined
18:26 NoCreativity joined
18:27 azahi joined
18:35 malaclyps joined
18:37 Glooomy joined
18:38 Glooomy joined
18:38 Glooomy joined
18:39 zaquest joined
18:39 Glooomy joined
18:40 Glooomy joined
18:44 albertus1 joined
18:45 aarvar joined
18:47 ExpHP joined
18:48 simendsjo joined
18:50 chlong joined
18:51 peterbec` joined
19:01 malaclyps joined
19:09 mattyw joined
19:11 uglyfigurine joined
19:12 m1dnight_ joined
19:19 nil_ joined
19:21 <nil_> Are Bifunctors (, multifunctors) and Applicatives related? If yes, how exactly?
19:23 mizu_no_oto_work joined
19:24 <kadoban> I don't think so. Bifunctor is just Functor, except 2 things you can fmap over in some sense, not one.
19:25 mattyw joined
19:44 Ferdirand joined
19:53 peterbec` joined
19:53 Rodya_ joined
19:54 splanch joined
19:57 nacon joined
19:57 nacon joined
20:02 azahi joined
20:08 yellowj joined
20:11 ircbrowse joined
20:13 gabor joined
20:18 uglyfigurine joined
20:24 jship joined
20:31 stef204 joined
20:35 peterbec` joined
20:37 malaclyps joined
20:42 zero_byte joined
20:42 <__rgn> glguy: ask :: Reader a a; ask = Reader id
20:43 <glguy> __rgn: That's right.
20:44 <__rgn> not ask = id, though
20:44 <glguy> Reader's a newtype, so it might as well be
20:44 <glguy> from the point of view of understanding how it works you can ignore the newtype value constructors
20:45 <glguy> Like I said, it's just a newtype for functions, so you'll gain more understanding learning about the function type directly
20:46 <glguy> from there's it's just adding and removing the value constructors to make the types work out
20:46 <glguy> It's not a metaphor, Reader is just another name for functions
20:47 <nil_> Looks like I can't have "derived" instances for polymorphic types?
20:47 <nil_> @def newtype Polynomial = Polynomial { terms :: Num a => [a] } deriving Show
20:47 <lambdabot> .L.hs:163:46: error: Not in scope: type variable ‘a’
20:47 <lambdabot>
20:47 <lambdabot> .L.hs:163:52: error: Not in scope: type variable ‘a’
20:47 <nil_> (Uh, I also needed to turn on Rank2Types)
20:48 <Akii> @def newtype Polynomial a = Polynomial { terms :: Num a => [a] } deriving Show
20:48 <lambdabot> .L.hs:164:31: error:
20:48 <lambdabot> • Could not deduce (Show a) arising from a use of ‘showsPrec’
20:48 <lambdabot> from the context: Typeable a
20:48 <jle`> nil_: your original type is a Rank2Type
20:48 <glguy> Either write: forall a. Polynomial { terms :: Num a ....
20:49 <glguy> or: Polynomial { terms :: forall a. Num a ....
20:49 <jle`> nil_: you might have wanted newtype Polynomial a = Polynomial { terms :: [a] }
20:49 <jle`> at least, if you're not sure what a RankN type is, then it's likely that it's not what you want in this situation
20:50 <__rgn> yeah i don't get what the connection between reader and ((->) r) is. how does ((->) r) give you a "shared environment"
20:50 <jle`> nil_: note the type parameter in 'Polynomial'
20:51 <jle`> __rgn: the environment is the input r
20:52 <jle`> 'Reader r a' is like an 'r -> a'
20:52 <Akii> is there an Contravariant instance for Reader?
20:53 <glguy> no, there can't be one
20:53 <glguy> Contravariant only works for the "last" parameter
20:53 <Akii> https://hackage.haskell.org/package/contravariant-1.4/docs/src/Data.Functor.Contravariant.html#line-225
20:53 <glguy> There's a Profunctor instance, though
20:53 <jle`> Akii: try writing it
20:53 <monochrom> The simple story is that Reader r a is a newtype wrapper over r->a.
20:53 <Akii> oh, that's on m
20:53 <glguy> Akii: Note that the thing you linked isn't what you asked for
20:54 <Akii> glguy: jle` got it
20:54 <jle`> Akii: that gives a contravariant instance for ReaderT r m, in the case that m is a Contravariant instance
20:54 <monochrom> The full story is that Reader r a is a type alias of ReaderT r Identity a, but then that is a newtype wrapper over r -> Identity a, so it is still r -> a.
20:54 <jle`> Akii: if yuo think of Reader r a as ReaderT r Identity a, then that construction doesn't work.
20:54 <monochrom> And not just this. >>= for both do the same thing.
20:54 <Akii> basically one would have to flip `Reader r a` to `Reader a r`
20:55 <jle`> often called 'Op'
20:55 <Akii> and then write an instance for `Reader a`
20:55 <jle`> data Op b a = Op (a -> b), the classic Contravariant instance
20:56 Rodya_ joined
20:56 <jle`> s/data/newtype
20:57 <jle`> and in that case, `Op b` would be an instance of Contravariant
20:57 <Akii> makes sense
20:57 <__rgn> (Reader r) >>= f = Reader $ \e -> runReader (f (r e)) e
20:57 <__rgn> what is e?
20:57 <jle`> are you familiar with lambdas
20:57 <Akii> the environment
20:57 <Akii> :D
20:57 <__rgn> but r was the environment
20:58 <jle`> ah, you can blame bad naming there
20:58 <jle`> 'r' is notht eenvironemnt there
20:58 <jle`> r is the Reader
20:58 <jle`> the 'r' in (Reader r) is not the environment
20:58 <jle`> it's a function that takes an environment
20:58 <jle`> calling it 'r' is definitely confusing
20:59 <jle`> __rgn: the Reader constructor wraps an (r -> a) function
20:59 <jle`> the (r -> a) function is, "given an environment of type 'r', make a value of type 'a'
20:59 Miroboru joined
20:59 <jle`> so, Reader $ (\e -> ...), the (\e -> ...) is that function
20:59 xsmalbil joined
21:00 <jle`> taking (e :: r), the environment of type 'r', and producing a value of type 'a'
21:01 takle joined
21:01 <Durbley> does anyone know if there are legit haskell video lectures somewhere
21:01 <jle`> legit as in non-fraudulent...?
21:02 <Durbley> no
21:03 <Durbley> legit as in a colloquial understanding of the word
21:03 <jle`> which is?
21:04 <Durbley> this definition works "in accordance with established rules, principles, or standards"
21:05 <__rgn> does runReader have some kind of definition
21:06 <monochrom> I think every Haskell video lectures I have seen satisfies that. Every bloody one of them.
21:07 <monochrom> But anyway, let me dig one out.
21:07 <jle`> __rgn: yes
21:07 <Durbley> okay so if a video purports to cover a language "in one hour" etc then never mentions monads, applicatives, functors, etc
21:07 <Durbley> is that up to established standards
21:07 <__rgn> runReader seems to take a reader and the environment
21:07 <Akii> what does "cover a language" even mean
21:08 <Akii> syntax?
21:08 <jle`> __rgn: traditionally, you'd have newtype Reader r a = Reader { runReader :: r -> a }
21:08 <jle`> __rgn: so runReader :: (Reader r a) -> (r -> a)
21:08 <jle`> runReader (Reader f) e = r f
21:08 <jle`> er, runReader (Reader f) env = f env
21:09 <jle`> it takes an "r -> a" in a Reader, and an "r", and gives the "a" result
21:09 <Durbley> i didnt really think i would need to be this explicit
21:10 <Akii> welcome to Haskell
21:10 <monochrom> https://www.youtube.com/watch?v=6COvD8oynmI is legit.
21:10 <Durbley> xd
21:10 <__rgn> wouldn't runReader :: r -> a imply that it takes a single argument?
21:10 <jle`> __rgn: are you familiar with record accessors?
21:10 <jle`> you might have seen something like data Person = Person { personName :: String, personAge :: Integer }
21:10 <Durbley> "Does anyone know of a video lecture series by an established expert that's reasonably complete but accessible to someone with a modest background in math/computer science?"
21:11 <jle`> __rgn: in that syntax, you define a type as well as accessors to its fields
21:11 <Akii> Durbley: https://www.youtube.com/user/DrBartosz/videos?spfreload=10&app=desktop
21:11 <Akii> about 30 hours later you've some background
21:11 <jle`> __rgn: so, it defines a type Person with a field 'personName', which gives you a function personName :: Person -> String
21:12 <jle`> @let data Person = Person { personName :: String, personAge :: Integer }
21:12 <lambdabot> Defined.
21:12 <jle`> :t personName
21:12 <__rgn> ok so "Reader" is implied as first argument
21:12 louispan joined
21:12 <lambdabot> Person -> String
21:12 <jle`> yes, that's how record accessors work
21:12 <jle`> defining something wth the field 'personName' defines a function Person -> String
21:12 <__rgn> got it
21:12 <Durbley> haskell community: as obtuse as the language
21:12 <jle`> note that the field personName is a String
21:12 diminishedprime joined
21:13 <jle`> but, the accessor function personName :: Person -> String
21:13 <nil_> jle`: how do I make Polynomial (the function) :: Num a => [a] -> Polynomial a though? Smart constructor and hide Polynomial?
21:14 <jle`> nil_: you acutally already have it
21:14 <nil_> I've got Polynomial :: [a] -> Polynomial a. :(
21:14 <jle`> Polynomial :: [a] -> Polynomial a, so Polynomial :: Num a => [a] -> Polynomial a already typechecks
21:15 <nil_> I want to _restrict_ that type to Num a => a's.
21:15 <Akii> Durbley: what do you want to achieve?
21:15 <jle`> oh, are you saying that you only want users to use the constructor on instances of Num?
21:15 <monochrom> Akii: Why would you link to a lot of category theory?
21:15 <jle`> nil_: what are you trying to do with that?
21:16 <nil_> jle`: I'm trying to model polynomials in one variable. :) I thought that was obvious.
21:16 <jle`> nil_: usually the established idiomatic way to do this is to only constrain the type parameters at the usage sites
21:16 <jle`> so if you ever write functions that use 'Polynomial a's and need 'a' to be an instance of Num, you'd have those functions constraned on Num
21:16 <Akii> monochrom: why not, it's a video lecture by a profesional and makes stuff accessible for someone with modest background in cs
21:16 <monochrom> But it doesn't teach Haskell.
21:17 xificurC joined
21:17 <Akii> all his examples are in Haskell
21:17 <jle`> nil_: it's also nicer this way because it gives hints to the users of those functions what operations the functions are potentially doing on the coefficients
21:17 <monochrom> https://www.futurelearn.com/courses/functional-programming-haskell
21:17 <monochrom> That still doesn't teach Haskell.
21:17 <jle`> nil_: for example, multipy :: Num a => Polynomial a -> Polynomial a -> Polynomial a
21:18 <jle`> divide :: Fractional a => Polynomial a -> Polynomial a -> Polynomial a
21:18 <Durbley> monochrom, how many lectures are there in the series you linked previously
21:18 <Durbley> i see only two atm on youtube
21:18 <jle`> printNicely :: Show a => Polynomial a -> Polynomial a -> Polynomial a, etc.
21:18 <monochrom> For all you know I would teach you Calculus using the Chinese language. That still doesn't teach you Chinese. In fact you will end up not learning Calculus either.
21:18 <monochrom> I don't know.
21:18 <Durbley> monochrom, i found this https://www.youtube.com/playlist?list=PLsAEIIjTPIo83ufYYkaPjUwZUuTe1LoZP
21:18 <Durbley> any thoughts?
21:18 <monochrom> Try my latest like.
21:18 <monochrom> err, Try my latest link.
21:19 <jle`> nil_: the typical example of this 'don't constrain the types, just the functions using the type' api philosophy is in the api for Map from containers
21:20 <jle`> and Set, too
21:20 <Durbley> monochrom, hmm seems I have to sign up to see the videos, or even to really see the scope?
21:20 <jle`> the Map/Set type don't actually constrain what they are allowed to contain
21:20 <monochrom> The list of topics is right at the bottom of the page, if that's what you mean.
21:21 <jle`> but the operations on them are constrained to the mimimal amount of constraints to let you know what it's doing
21:21 <Durbley> monochrom, it just says "Monads"
21:21 <nil_> jle`, those are both perfectly polymorphic types. Polynomial is not supposed to be polymorphic that way.
21:22 <nil_> You can't have Polynomial [const 4, id, undefined]
21:22 <jle`> it's not a perfect analogy, but, constraining the functions is the usual way to go about it
21:22 <Durbley> I would guess I already know most everything in this series. I'm gonna sign up to check. Thanks
21:22 <nil_> Yeah, I understand the strategy you're suggestion.
21:22 <nil_> ...ing
21:22 <Durbley> monochrom, can you take a look at the youtube playlist I linked?
21:23 <jle`> nil_: those might not be meaningful polynomial functions to you, but you probably won't be able to do anything with them either
21:23 <jle`> cause all of your functions will have the appropriate constraints
21:23 <jle`> so in a way it's a non-issue
21:23 <monochrom> No, I'm busy.
21:23 <Durbley> Ah monochrom the class hasn't started. It says it'll email me when it does. I can't see any lectures
21:23 <Durbley> Thanks though
21:23 <jle`> Durbley: try asking in #haskell too, they field beginner questions there :)
21:23 sshine joined
21:24 <jle`> and there's usually more activity
21:24 sbrg joined
21:24 sbrg joined
21:25 <nil_> jle`: huh, that's a new way to look at it, my functions are sure all going to have the right types.
21:25 <jle`> nil_: you could "make" such a Polynomial, but once you're there, you'll find that you can't use it with any of your polynomial functions, so it effectively doesn't exist
21:25 <monochrom> That's unfortunate. That course was announced last August. I would think they would have finished the whole thing by now.
21:25 <Durbley> seems likely it doesn't really exist. will do though
21:25 <nil_> I'm just wary of allowing illegal states. And a polynomial of non-numbers is very illegal.
21:26 <jle`> it does feel weird, i'll admit
21:26 <jle`> but maybe you can think of it as disallowing operations on illegal states
21:26 <nil_> Yeah, I think I get what you're saying.
21:26 <monochrom> But Cayley and Hamilton totally digged polynomials of matrices.
21:26 <jle`> you might have an illegal state, but it's dead in the water
21:27 <nil_> monochrom: Matrices are still Nums, no?
21:27 <monochrom> NOOOO! They are functions!
21:27 <nil_> ...too
21:27 <* monochrom> hugs his copy of Linear Algebra Done Right
21:27 <* jle`> . o O ( functions can be Num )
21:28 <monochrom> Then again, storing as matrix kills the illegal state of non-linear function. :)
21:29 <nil_> To hell with it, I'll make it monomorphic. newtype Polynomial = Polynomial [Float]
21:29 <jle`> you could say that `Matrix n m` is just an (Vec m -> Vec n) that's guarunteed to be linear
21:29 <monochrom> Float is too few digits.
21:29 <jle`> nil_: i'd recommend the polymorphic route
21:29 <jle`> since it lets your functions speak more
21:30 <jle`> also you get a cute Functor instance if you're into that kind of stuff
21:30 <nil_> I'm all about typeclasses, so sure.
21:30 <jle`> there was this nice talk a while back about the advantages you'd get from making types polymorphic even when you only ever intend to use them with one type
21:30 <jle`> if you write your functions as constrained on typeclasses, you'll avoid a large class of bugs, too
21:30 <nil_> Did the talk mention making illegal states unrepresentable?
21:31 <jle`> i'm not sure
21:31 <jle`> i didn't watch it because i just read the headline and concluded that i agreed
21:31 <nil_> I know I'm going on about this, but it feels pretty important to me.
21:31 <nil_> :D
21:31 <nil_> Okay.
21:31 <jle`> :D
21:31 <jle`> but yeah, making it polynomorphic prevents you from doing silly things like square rooting when you meant to double
21:32 <nil_> Did you mean to write "monomorphic"?
21:32 <jle`> A `Num a => Polynomial a -> Polynomial a` has much, much less possible functions than `Ploynomial Float -> Polynomial Float`
21:32 <jle`> no, i mean polymorphic
21:33 <jle`> if you wrote a Polynomimal Float -> Polynomial Float that is supposed to double every coefficient, you might accidentally do something silly like take a square root
21:33 <jle`> or divide something
21:33 <jle`> or take a sine
21:33 <nil_> Hmm, I think you're right.
21:33 <jle`> but if you wrote a `Num a => Polynomial a -> Polynomial a`, you can rest assured that no divisions or square rooting or taking of sines is possible
21:34 <monochrom> nil_, jle` is talking about the same phenomenon as that forall a. a->a is much more assuring than Int->Int.
21:34 <jle`> of course, you might have accidentally subtracted instead of multiplied still, but that's still a huge swath of potential bugs and incorrect implementations that are eliminated
21:34 <nil_> monochrom: I realized halfway through, but thanks for pointing it out anyways.
21:34 <jle`> like 99.99999% of possible bugs are gone
21:34 <jle`> number is definitely not made-up
21:35 uglyfigurine joined
21:35 malaclyps joined
21:35 <nil_> Yeah ok, let's make it polymorphic. I can still stick a (Num a) constraint in there like glguy said.
21:35 <jle`> also if you wrote Show a => Polynomial a -> String, then you can rest assured that you aren't accidentally doubling or subtracting any numbers
21:35 <monochrom> That is more a statement about humanity than a statement about bugs :)
21:36 peterbec` joined
21:39 <nil_> Oh yeah, another thing I've been meaning to ask: what's the easiest way to zipWith two lists with a monoidal operation but keep the longer tail by zipping it against repeat mempty, huh, looks like I just typed out the ideal solution.
21:39 <nil_> Thanks guys!!
21:41 <nil_> monochrom: since you hug textbooks sometimes, what book do you recommend on CT?
21:42 <monochrom> I don't have a recommendation. I didn't read a single one. I mixed-read several sources.
21:42 <nil_> Okay, what other books do you occasionally hug?
21:43 <Akii> :D
21:44 <jle`> nil_: i'm not sure i've ever found a good way using zipWith
21:44 <jle`> because you'll have to check which list is longer before padding
21:44 <monochrom> I think the major ones I ran into were Steve Easterbrook's talk, Fokkinga's gentle introduction, Bird & de Moor's Algebra of Programming, and Pierce's "for computer scientists".
21:45 <jle`> the best way might be to write your own function
21:45 <nil_> jle`: I'm implementing (+) for Polynomial. I can just check up front which list is shorter and append (repeat mempty) to it.
21:46 <nil_> @karma++ monochrom
21:46 <lambdabot> monochrom's karma raised to 128.
21:46 <nil_> @karma++ jle`
21:46 <lambdabot> jle`'s karma raised to 29.
21:46 darthdeus joined
21:50 diminishedprime joined
21:53 hiratara joined
22:12 zero_byte joined
22:12 <nil_> Is there an off-the-shelf combinator for this? \f -> groupBy ((==) `on` f) . sortBy f
22:14 peterbec` joined
22:14 uglyfigurine joined
22:16 conal joined
22:20 Denthir joined
22:21 louispan joined
22:26 animated joined
22:30 <hexagoxel> :t \f -> groupBy ((==) `on` f) . sortBy f
22:30 <lambdabot> Eq (a -> Ordering) => (a -> a -> Ordering) -> [a] -> [[a]]
22:31 hiratara joined
22:33 louispan joined
22:42 louispan joined
22:42 Gloomy joined
22:45 Rodya_ joined
22:46 mcspud joined
22:53 conal joined
23:04 jship joined
23:11 chatter29 joined
23:12 chatter29 joined
23:15 <glguy> :t \f -> groupBy ((==) `on` f) . sortBy (comparing f)
23:15 <lambdabot> Ord a => (a1 -> a) -> [a1] -> [[a1]]
23:21 peterbec` joined
23:26 louispan joined
23:27 vicsy joined
23:31 aarvar joined
23:36 <vicsy> hi
23:38 <Durbley> is it correct to say there is only one value of type IO ()
23:39 <kadoban> No
23:39 <vicsy> no
23:39 <kadoban> :t putStrLn "hi"
23:40 <lambdabot> IO ()
23:40 <kadoban> :t putStrLn "hello"
23:40 <lambdabot> IO ()
23:40 <vicsy> no
23:40 <kadoban> There's two very similar but different ones. There exist an infinite number of very much more different ones.
23:44 <vicsy> really
23:46 Rodya_ joined
23:49 splanch joined
23:52 geekosaur joined
23:53 geekosaur joined
23:56 suls joined