<    April 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
00:13 vaibhavsagar joined
00:15 takle joined
00:16 acarrico joined
00:22 MrRicecake joined
00:34 takle joined
00:40 nicknovitski joined
00:47 takle joined
00:51 morphit joined
01:06 takle joined
01:06 eacameron joined
01:13 takle joined
01:24 Pupnik joined
01:24 michbad joined
01:28 eacameron joined
01:41 texasmynsted joined
02:08 harfangk joined
02:17 takle joined
02:36 takle joined
02:43 takle joined
02:48 ebsen joined
03:01 exferenceBot joined
03:02 takle joined
03:03 zero_byte joined
03:05 hexagoxel joined
03:15 systemfault joined
03:15 seagreen joined
03:30 takle joined
03:33 ebsen joined
03:38 takle joined
03:45 takle joined
03:47 pinkythepig joined
03:59 takle joined
04:06 takle joined
04:27 takle joined
04:28 mac10688 joined
04:44 takle joined
04:51 takle joined
04:52 systemfault joined
04:55 freebrew81 joined
04:57 <freebrew81> /
05:00 systemfault joined
05:15 nicknovitski joined
05:17 takle joined
05:21 eacameron joined
05:32 eacameron joined
05:32 Pupnik_ joined
05:41 wei2912 joined
05:41 yellowj joined
05:42 takle joined
05:45 uglyfigurine joined
05:54 malaclyps joined
06:00 haskelleksah joined
06:00 takle joined
06:19 takle joined
06:28 zacts joined
06:42 govg joined
06:44 __bluebell__ joined
06:48 condy joined
06:50 vaibhavsagar joined
06:53 takle joined
07:18 nullcone joined
07:18 takle joined
07:26 eacameron joined
07:29 albertus1 joined
07:30 t0by joined
07:30 t0by joined
07:30 albertus1 joined
07:38 OscarZ joined
07:41 eacameron joined
07:41 Denthir joined
07:44 <Akii> benzrf: thanks, put my solution into the comment
07:48 emmanuel_erc left
07:48 kobigurk joined
07:55 takle joined
07:57 eacameron joined
08:03 eacameron joined
08:08 azahi joined
08:10 <Akii> http://www.staff.science.uu.nl/~swier004/Publications/DataTypesALaCarte.pdf
08:12 zacts joined
08:14 lithie joined
08:28 eacameron joined
08:30 takle joined
08:33 eacameron joined
08:40 chbatey joined
08:44 nicknovitski joined
08:50 eacameron joined
08:54 madjestic joined
08:56 eacameron joined
09:02 takle joined
09:06 eacameron joined
09:16 eacameron joined
09:19 Gurkenglas joined
09:21 meandi joined
09:23 eacameron joined
09:29 takle joined
09:30 yellowj joined
09:35 delexi joined
09:42 takle joined
09:42 eacameron joined
09:49 codeone joined
09:55 Denthir joined
09:58 eacameron joined
10:05 eacameron joined
10:11 eacameron joined
10:18 eacameron joined
10:29 eacameron joined
10:38 coec__ joined
10:40 exferenceBot joined
10:42 eacameron joined
10:44 delexi joined
10:46 coec__ left
10:49 wildlander joined
10:49 binaryplease joined
10:50 wildlander joined
10:51 wildlander joined
10:51 wildlander joined
10:53 haskelleksah joined
10:53 beeman joined
10:55 eacameron joined
10:56 vaibhavsagar joined
11:06 eacameron joined
11:10 dni- joined
11:12 kritzcreek_ joined
11:18 eacameron joined
11:24 eacameron joined
11:31 netheranthem joined
11:34 eacameron joined
11:35 pbrant joined
11:40 eacameron joined
11:46 eacameron joined
11:49 <sudoreboot[m]> What is the practical difference between (=<<) and (>>=) ? Is it just syntactic sugar?
11:51 <Geekingfrog> I'd say it's syntactic sugar, and a matter of taste
11:55 beeman left
12:04 mengu joined
12:07 __rgn joined
12:11 Pupnik joined
12:29 kongobongo joined
12:34 <kongobongo> Hi, could you recommend a HTTP server for serving static files generated by Hakyll. Using servant sounds like overkill. What do you think? Thank you in advance for any help.
12:36 <Geekingfrog> kongobongo, if it's 100% static I would go with nginx
12:38 <Geekingfrog> If you really want a haskell solution you can have a look at: https://hackage.haskell.org/package/wai-app-static
12:46 <kongobongo> I would prefer to limit C usage in the wild and not add yet another instance of it :) Could you point me to any resources on the topic before I start manually evaluating server components from servant, happstack, spock, snap, etc?
12:48 wei2912 joined
12:48 <Geekingfrog> I've only ever used the wai-app-static linked above
12:48 <zaquest> kongobongo, if you want haskell solution maybe try mighttpd2, authors claim it's comparable to nginx in terms of performance
12:52 Denthir joined
12:59 xmonader joined
12:59 <kongobongo> Cheers, I thought about mighttpd2. It is warp based, so I am going to classify it as 'warp/wai-based solution'. I guess choosing randomly will cost me less time than evaluating snap, happstack, servant, etc. Alas, https://wiki.haskell.org/Web/Servers is not very informative.
13:15 <sudoreboot[m]> Is there any reason one could not use monad composition ( `(=<<)`, `(>>=)` ) in place of `do` notation?
13:16 <Gurkenglas> Nope. do notation was invented because using "monad composition" everywhere gets ugly. do notation is desugered by the compiler to "monad composition".
13:17 <sudoreboot[m]> Is there a nice way to format longer compositions? I'm trying to get the hang of these so I'm experimenting with it a bit
13:19 <sudoreboot[m]> I'm more intrigued by composition as opposed to the quite imperative-looking do notation you see everywhere
13:20 eacameron joined
13:22 acarrico joined
13:29 takle joined
13:34 eacameron joined
13:44 takle joined
13:47 mengu joined
13:48 haskelleksah joined
13:52 takle joined
13:57 acarrico joined
14:12 takle joined
14:14 will__ joined
14:14 <Gurkenglas> sudoreboot[m], you may be interested in applicative style
14:15 mengu joined
14:15 govg joined
14:15 <will__> s
14:16 <will__> quit
14:16 <will__> exit
14:17 harfangk joined
14:22 delexi1 joined
14:33 takle joined
14:34 eacameron joined
14:42 eacameron joined
14:43 takle joined
14:49 eacameron joined
14:58 acarrico joined
14:58 zero_byte joined
15:01 smichel17 joined
15:10 <sudoreboot[m]> Gurkenglas: Thanks, I'll look into that
15:17 mengu joined
15:24 Denthir joined
15:26 nicknovitski joined
15:31 chbatey joined
15:38 texasmynsted joined
16:02 xmonader2 joined
16:20 eacameron joined
16:20 eacameron joined
16:29 myrkraverk_ joined
16:30 NoCreativity joined
16:33 malaclyps joined
16:38 RoyalNightGuard joined
16:51 kritzcreek_ joined
16:54 mengu joined
16:59 bkboggy joined
17:03 albertus1 joined
17:03 binaryplease joined
17:09 Denthir joined
17:17 systemfault joined
17:18 takle joined
17:20 takle joined
17:21 eacameron joined
17:23 haskelleksah joined
17:30 zaquest joined
17:32 thc202 joined
17:50 chbatey joined
17:51 <qmm> newtype Identity a = Identity a
17:51 <qmm> instance Functor Identity where
17:51 <qmm> fmap f (Identity a) = Identity (f a)
17:51 <qmm> fmap (\x -> x+1) (Identity 3) -- results in Identity 4
17:51 <Akii> > fmap (+1) (Identity 3)
17:51 <lambdabot> Identity 4
17:52 <qmm> i don't understand how an identity can be manipulated
17:52 <qmm> maybe i don't understand Identity though
17:52 <qmm> s/maybe/clearly
17:52 <Akii> what do you mean by "manipulated"?
17:53 <qmm> > fmap id [1,2,3]
17:53 <lambdabot> [1,2,3]
17:53 <qmm> > fmap (+1) [1,2,3]
17:53 <lambdabot> [2,3,4]
17:53 <qmm> > id 1
17:53 <lambdabot> 1
17:54 <Akii> > (fmap . fmap) (+1) (Identity [1,2,3])
17:54 <lambdabot> Identity [2,3,4]
17:54 <qmm> i was about to go the applicative route
17:55 <qmm> Akii: though that's very nice :)
17:55 <Akii> well it's just reaching into the encapsulated functor
17:56 <Akii> I know identity is very important in category theory
17:57 <Akii> but again, what do you mean by manipulation
17:58 <Sornaensis> > (fmap fmap fmap) (+1) (Identity [1,2,3])
17:58 <lambdabot> Identity [2,3,4]
17:58 <Akii> :o
17:58 <sbrg> qmm: what is confusing about it? The Identity functor/monad takes a value, and if you "run it", gives you that value back.
18:00 <Sornaensis> Akii: (->) a is a functor with fmap = (.)
18:00 <qmm> oh, fmap lifts (+1) into Identity
18:00 <qmm> and then it returns the resulting value lifted
18:01 <qmm> that makes sense
18:03 <glguy> fmap takes a function from a to b and gives a function from f a to f b
18:03 <glguy> so for Identity you go from: (a -> b) to (Identity a -> Identity b)
18:04 <Sornaensis> @src Identity
18:04 <lambdabot> newtype Identity a = Identity { runIdentity :: a }
18:04 <Sornaensis> qmm: are you familiar with the typical formulation of fmap?
18:04 <glguy> It's called identity because it's a type function whose returns is equal to its argument
18:04 <glguy> for values we have id x = x
18:05 myrkraverk_ joined
18:05 <glguy> for types we have Identity a which wraps an a
18:05 <texasmynsted> hello
18:08 <Akii> hi
18:09 <Akii> hopefully not out of scope: what does this mean categorially
18:09 conal joined
18:09 <Akii> and why does it need a type
18:10 <Akii> isn't `fmap id` the identity functor?
18:10 <Sornaensis> @src State
18:10 <lambdabot> type State s = StateT s Identity
18:10 <lambdabot> --OR
18:10 <lambdabot> data State s a = State { runState :: s -> (a, s) }
18:10 <glguy> no, but there's a law that says that fmap id = id
18:19 <glguy> A "functor" is a mapping of objects to objects and arrows to arrows. our objects are types with kind *, and our arrows are values with type (a -> b) where a and b have kind *
18:19 <glguy> The "identity function" maps those types with the type 'Identity'
18:20 <glguy> and an implementation of fmap where fmap f = \(Identity x) -> Identity (f x)
18:20 <glguy> The "identity functor"** maps those types with the type 'Identity'
18:20 haskelleksah joined
18:20 <glguy> the implementation of fmap is the mapping of arrows
18:20 <benzrf> hey Akii
18:20 <Akii> hey :D
18:21 <benzrf> did you read the a la carte paper, then? :)
18:21 <Akii> not completely, yet
18:21 <Akii> but I encountered the data type
18:21 <Akii> really interesting stuff
18:21 <benzrf> which data type?
18:21 <Akii> well this f (Mu f) thing
18:21 <benzrf> ah
18:22 <benzrf> have you seen generalized recursion through it?
18:22 eacameron joined
18:22 <Akii> data Expr f = In (f (Expr f))
18:22 <Akii> ^ that's the definition in the paper
18:22 <benzrf> but i mean have you seen the notion of folding through one of those
18:23 <Akii> they do that in the paper as well
18:23 <benzrf> ah, foldExpr
18:23 <benzrf> neat
18:23 <Akii> so I've seen that
18:23 <benzrf> ok cool :)
18:23 <benzrf> yeah, that's what i was building towards!
18:23 carlomagno joined
18:23 <Akii> need to put more effort into it though, like coding along
18:23 <Akii> ye :D
18:24 <benzrf> have you seen that most straightforward "data"-y types can be expressed as fixpoints of polynomial functors?
18:25 <Akii> is that a fancy way of saying their a mix of Plus and Times types? :D
18:25 <benzrf> er, kinda?
18:25 <Akii> if so, yes
18:26 <benzrf> like have you seen how to express List as such
18:26 <Akii> they're
18:26 <Akii> omg
18:26 <Akii> english, how does it work
18:27 <Akii> what I was saying, one can construct any data-ish type through sum and product; hence their name - algebraic data types
18:27 <Akii> and that goes even further to logarithms and polynomials
18:27 <Akii> :D
18:28 <Akii> have I seen a list though, just the standard definition
18:29 <benzrf> @let type List' a = Mu (Const () :+: Const a :*: Identity)
18:29 <lambdabot> .L.hs:162:20: error:
18:29 <lambdabot> Not in scope: type constructor or class ‘:+:’
18:29 <lambdabot> Perhaps you meant ‘:~:’ (imported from Data.Typeable)
18:29 <benzrf> @let data (f :+: g) a = InL (f a) | InR (g a)
18:29 <lambdabot> Defined.
18:29 <jle`> -- @let import GHC.Generics
18:29 <benzrf> @let data (f :*: g) a = Prod (f a) (g a)
18:29 <lambdabot> Defined.
18:29 <benzrf> o
18:29 <benzrf> @let type List' a = Mu (Const () :+: (Const a :*: Identity))
18:29 <lambdabot> Defined.
18:30 <benzrf> @let nil' :: List' a; nil' = In (Const ())
18:30 <lambdabot> .L.hs:170:8: error:
18:30 <lambdabot> • Couldn't match type ‘Const ()’
18:30 <lambdabot> with ‘Const () :+: (Const a :*: Identity)’
18:30 <benzrf> oops
18:30 <benzrf> @let nil' :: List' a; nil' = In (InL (Const ()))
18:30 <lambdabot> Defined.
18:30 <benzrf> @let cons' :: a -> List' a -> List' a; cons' x xs = In (InR (Prod (Const x) (Identity xs)))
18:30 <lambdabot> .L.hs:175:18: error:
18:30 <lambdabot> Ambiguous occurrence ‘InR’
18:30 <lambdabot> It could refer to either ‘Lambdabot.Plugin.Haskell.Eval.Trusted.InR’,
18:30 <benzrf> heck
18:30 <* sbrg> is reminded of aphyr.com
18:31 <benzrf> hah
18:31 <benzrf> @let cons' :: a -> List' a -> List' a; cons' x xs = In (L.InR (Prod (Const x) (Identity xs)))
18:31 <lambdabot> Defined.
18:32 <benzrf> so
18:32 <benzrf> if we have: type M = Const () :+: (Const a :*: Identity)
18:32 aarvar joined
18:32 <benzrf> then M Foo is equivalent to:
18:33 <benzrf> Either () (a, Foo)
18:33 <benzrf> so if we take the fixpoint of that, we have
18:33 <benzrf> type List' a = Either () (a, List' a)
18:33 <benzrf> (which is illegal Haskell, but you get the idea)
18:34 contiver joined
18:34 <Akii> I think I do :D
18:35 <Akii> interesting
18:36 <benzrf> we can also work backwards
18:36 <benzrf> let's say we have a type like:
18:36 <benzrf> @let data BinIntTree = Leaf Int | Branch BinIntTree BinIntTree
18:36 <lambdabot> Defined.
18:36 <benzrf> we want to express BinIntTree as the fix point of some functor - that is, we want to solve for F in:
18:37 <benzrf> F BinIntTree \iso BinIntTree
18:37 <benzrf> er wait no i fucked up
18:37 mac10688 joined
18:37 <benzrf> Identity would solve for F here but of course Mu Identity isn't isomorphic to BinIntTree
18:38 <benzrf> because *any* type is a fixpoint of Identity, but Mu is only one *particular* fix point of it
18:38 <benzrf> let me back up >.>
18:38 chbatey joined
18:39 <Akii> this type of fixpoint? https://en.wikipedia.org/wiki/Fixed_point_(mathematics)
18:39 <benzrf> yeah
18:39 <benzrf> Mu computes the least fix point of a functor
18:39 <benzrf> by definition!
18:39 <benzrf> Mu f = f (Mu f
18:39 <benzrf> )
18:40 <benzrf> and the definition of a fixpoint is "m = f m"
18:40 <Akii> oh boy :D
18:40 <Akii> but I see
18:43 vaibhavsagar joined
18:45 aarvar left
18:47 <benzrf> Akii: sorry back
18:48 <benzrf> ok
18:48 <benzrf> so we have data BinIntTree = Leaf Int | Branch BinIntTree BinIntTree
18:48 <benzrf> if we factor out the recursion as an argument instead, we have
18:48 <benzrf> data BinIntTreeF recurse = Leaf Int | Branch recurse recurse
18:48 <benzrf> now we have "Mu BinIntTreeF \isoBinIntTree"
18:48 <benzrf> er
18:54 <xmonader2> newtype Name = Name String deriving (Eq, Show) ... what does it mean to fmap Name (Just "myname") ?
18:55 kyleschmidt joined
18:55 <xmonader2> shouldn't Name here be a function to be mapped?
18:55 <sbrg> xmonader2: that won't type-check.
18:56 <kyleschmidt> I am having difficulty discerning the difference between type, data, and newtype and when to use them.
18:56 <xmonader2> snippet taken from here sbrg http://lpaste.net/4835310985411559424
18:57 <xmonader2> kyleschmidt, afaik type is to make an alias for instance type Email = String, for readability in the code
18:57 mengu joined
18:58 <sbrg> xmonader2: oh, yeah, my bad. it's using the (-> a) Functor instance
18:58 <sbrg> oh my god, i'm a moron
18:58 <sbrg> never mind.
18:58 chbatey joined
18:58 <geekosaur> kyleschmidt, https://wiki.haskell.org/Type
18:59 <sbrg> xmonader2: "Name" is a function which takes a String and returns a Name. `Just "foo"` is a functor wrapping a String, so fmap Name (Just "foo") is (Just (Name "foo"))
18:59 <geekosaur> `data` is the usual workhorse for defining a new type. `newtype` is generally used when giving an existing type a new behavior. `type` is just an alias
19:00 <sbrg> I should probably use consistent quotes <.<
19:02 <xmonader2> sbrg, u explained it perfectly thank you ^_^
19:02 <sbrg> yw
19:03 <kyleschmidt> ok, so when the type of the data is the same as the constructor then the data is of that type.
19:03 <kyleschmidt> But if the type of the data is different than the custructor then what?
19:04 <sbrg> kyleschmidt: The name of the type and the name of the constructor(s) don't have to match.
19:04 <sbrg> you can have `data Foo = Bar`, for example.
19:04 <geekosaur> they're different namespaces. some folks believe one should always use different names for the type vs. data constructors just to help keep them straight
19:05 <kyleschmidt> right but what does that mean? The result of the constructor Bar will be of type Foo?
19:05 <sbrg> kyleschmidt: The above means that I created a new type called `Foo` which has one inhabitant(= value of that type) which is `Bar`
19:06 malaclyps joined
19:06 <sbrg> so Bar has the type Foo
19:07 <kyleschmidt> but isn't Bar also a type?
19:07 <kyleschmidt> or what is the formal name of Bar?
19:07 <sbrg> Nope, not a type. What do you mean by formal name?
19:10 <kyleschmidt> is Bar also created within `data Foo = Bar` or how do I create a Bar and what is Bar called in Haskell?
19:10 <sbrg> When I define the type `Foo`, I also define its value constructors. In this case, there is a single value constructor named `Bar`. This value constructor takes no arguments.
19:11 <sbrg> So you're possibly looking for value constructor?
19:11 <benzrf> "value constructors" are also called "data constructors"
19:11 <sbrg> A better example may be: `data Days = Sunday | Monday | Tuesday ..`
19:11 haskelleksah joined
19:12 <sbrg> `Days` is a type, and the individual days are values of that type.
19:14 <benzrf> Akii: so you can define "muFold :: Functor f => (f a -> a) -> Mu f -> a", right
19:14 <benzrf> fun: you can also define "muUnfold :: Functor f => (a -> f a) -> a -> Mu f"
19:14 <benzrf> :>
19:15 initiumdoeslinux joined
19:15 ryantm joined
19:15 <ryantm> How do I use !? with Data.Map.Strict? I can't do `import Data.Map.Strict ((!?))` it says it doesn't export it.
19:15 <benzrf> @let data Factored n = Prime n | Product n n deriving (Show, Functor)
19:15 <lambdabot> Defined.
19:16 <kyleschmidt> sbrg: thank you for your help!
19:16 <sbrg> ryantm: what is !?
19:16 <benzrf> @let muUnfold :: Functor f => (a -> f a) -> a -> Mu f; muUnfold coAlg a = fmap (muUnfold coAlg) (coAlg a)
19:16 <sbrg> kyleschmidt: no problem
19:16 <lambdabot> .L.hs:185:20: error:
19:16 <lambdabot> • Couldn't match kind ‘*’ with ‘* -> *’
19:16 <lambdabot> When matching types
19:16 <benzrf> woops
19:16 <benzrf> @let muUnfold :: Functor f => (a -> f a) -> a -> Mu f; muUnfold coAlg a = In (fmap (muUnfold coAlg) (coAlg a))
19:16 <lambdabot> Defined.
19:16 <sbrg> @hoogle (!?)
19:16 <lambdabot> Data.Map.Internal (!?) :: Ord k => Map k a -> k -> Maybe a
19:16 <lambdabot> Data.Map.Lazy (!?) :: Ord k => Map k a -> k -> Maybe a
19:16 <lambdabot> Data.Map.Strict (!?) :: Ord k => Map k a -> k -> Maybe a
19:16 <ryantm> sbrg: https://hackage.haskell.org/package/containers-0.5.10.2/docs/Data-Map-Strict.html It's the safe accessor
19:17 <sbrg> Huh, never heard of that before. But there's `lookup`
19:17 <sbrg> perhaps you have an older version of containers? I think this is a new addition
19:17 kyleschmidt left
19:17 kyleschmidt joined
19:18 <benzrf> @let factored n = case find (\f -> n `mod` f == 0) [2..n - 1] of Nothing -> Prime n; Just f -> Product f (n `div` f)
19:18 <lambdabot> .L.hs:188:19: error:
19:18 <lambdabot> Ambiguous occurrence ‘Product’
19:18 <lambdabot> It could refer to either ‘Data.Monoid.Product’,
19:18 <benzrf> heck
19:18 <benzrf> @let factored n = case find (\f -> n `mod` f == 0) [2..n - 1] of Nothing -> Prime n; Just f -> L.Product f (n `div` f)
19:18 <Akii> ^^
19:18 <lambdabot> Defined.
19:18 <benzrf> > factored 10
19:18 <lambdabot> Product 2 5
19:18 <benzrf> > factored 13
19:18 <lambdabot> Prime 13
19:19 <benzrf> and then we can do,
19:19 <benzrf> > muUnfold factored 36
19:19 <lambdabot> error:
19:19 <lambdabot> • No instance for (Show (Mu Factored))
19:19 <lambdabot> arising from a use of ‘show_M597152624293887429726180’
19:19 <benzrf> oh wait does Mu now have a show instance??
19:19 <ryantm> sbrg: thanks, lookup worked.
19:19 <benzrf> er wait fuck i also messed that up
19:19 <* benzrf> facepalms
19:19 <benzrf> let me write this in a file first...
19:19 <benzrf> sorry
19:23 NoCreativity joined
19:33 eacameron joined
19:35 <benzrf> Akii: ok that took way longer than i intended it to!!! https://gist.github.com/5247ca5c34636a5d07ba5dac5399cb3b
19:37 chbatey joined
19:37 <benzrf> the most irritating thing about programming this way, in my opinion, is that you end up nesting 100000x more constructors than you would with a nice plain brand new recursive type:
19:37 <benzrf> Fix (InR (Pair (Identity (Fix (InL (Const 2)))) (Identity (Fix (InR (Pair (Identity (Fix (InL (Const 2)))) (Identity (Fix (InR (Pair (Identity (Fix (InL (Const 2)))) (Identity (Fix (InR (Pair (Identity (Fix (InL (Const 3)))) (Identity (Fix (InR (Pair (Identity (Fix (InL (Const 3)))) (Identity (Fix (InL (Const 5))))))))))))))))))))))
19:38 vicfred joined
19:39 <benzrf> compare that with: Prod (Prime 2) (Prod (Prime 2) (Prod (Prime 2) (Prod (Prime 3) (Prod (Prime 3) (Prime 5)))))
19:40 <haskelleksah> Hi. I am trying to understand the semantics of the type of list: data [] a = [] | a : [a]
19:40 <haskelleksah> The confusing part is the [a]…can I view [a] as same as [] a. So basically the second data constructur reads as a…cons…[] a …but I am not sure if this is correct because “[] a” is a Type constructor and was never defined as a Data constructor :/
19:41 <benzrf> haskelleksah: at the type level, [a] is just syntactic sugar for [] a
19:41 <benzrf> at the value level, [a] is syntactic sugar for a:[]
19:41 <benzrf> Akii: if you ever want to use this kind of functor-fixpoint programming in a real program for real purposes, you may appreciate the recursion-schemes library's approach -
19:43 <benzrf> Akii: it lets you - instead of literally defining your types as `Mu SomeFunctor' and dealing with millions of constructors - it lets you instantiate a typeclass with a method for "peeling back" one layer, like "YourType -> SomeFunctor YourType"
19:43 <benzrf> then it lets you do all the fancy recursion biz in terms of that, by using the typeclass
19:44 Denthir joined
19:46 <benzrf> be back later though
19:48 <haskelleksah> benzrf: thanks for that explanation…”at the type level, [a] is just syntactic sugar for [] a” besically makes me see the type definition as data [] a = [] | a : [] a which makes more sene to me since I can read a : [] a as having a data constructor “:” which takes two values of type “a” and “[] a”
19:50 systemfault joined
19:53 <glguy> yes, [] and (:) are the constructors for lists
19:56 gibbers joined
19:56 nullcone joined
19:58 davs joined
20:05 acarrico joined
20:07 karchie joined
20:37 takle joined
20:40 <xmonader2> can anoyone point me to a simple to grasp reader monad tutorial?
20:47 malaclyps joined
20:49 holygun joined
20:53 texasmynsted joined
20:55 <monochrom> typeclassopedia may be it.
20:55 <monochrom> https://wiki.haskell.org/Typeclassopedia
20:55 MrRicecake joined
20:56 <monochrom> Ah, is this where the idea of "context" first appeared?
20:57 pilne joined
20:57 <monochrom> Hrm, probably not, it may be a recent edit.
21:00 mac10688 joined
21:03 xificurC joined
21:19 Deide joined
21:24 madsa joined
21:30 <benzrf> xmonader2: think of a value of type "Reader r a" as an 'a' which is implicitly parameterized over an 'r', like the way physicists say "x = y + 3" makes x "a function of y"
21:31 <benzrf> xmonader2: then "fmap f readerVal" is just applying f to the value, resulting in a new value implicitly parameterized over an 'r'
21:33 smwentum joined
21:34 smwentum1 joined
21:46 conal joined
21:51 <xmonader2> benzrf, i guess i got the concept right but I'm just struggling with the implementation :(
21:51 <smwentum1> hi
21:51 <xmonader2> smwentum1, hello
21:51 <benzrf> xmonader2: oh
21:51 <benzrf> xmonader2: h-have you tried following the types?
21:52 <xmonader2> benzrf, for like 2 or 3 hours now.. not sure i'm just not smart enough :(
21:55 mengu joined
21:55 hiratara joined
21:56 <Sornaensis> :t foldMap
21:56 <lambdabot> (Monoid m, Foldable t) => (a -> m) -> t a -> m
22:04 aarvar joined
22:05 gibbers joined
22:05 yellowj joined
22:05 estantulo joined
22:10 <Sornaensis> > foldr1 (\x y -> fromIntegral x + y / 2) [1,2,3]
22:10 <lambdabot> error:
22:10 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M122702966205...
22:10 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
22:11 haskelleksah joined
22:22 <monochrom> @type \x y -> fromIntegral x + y / 2
22:22 <lambdabot> (Fractional a, Integral a1) => a1 -> a -> a
22:23 <monochrom> But foldr1 also needs a = a1. So you are left with the simultaneous requirement of both Fractional and Integral on the same type. This doesn't exist.
22:25 Blacink joined
22:26 <xmonader2> if we got ```newtype Reader r a = Reader { runReader :: r -> a }```
22:27 <xmonader2> why the functor defintion is ```instance Functor (Reader r) where``` ?
22:27 <xmonader2> shouldn't it be (Reader r a)?
22:27 <monochrom> No, and that's the point.
22:27 <monochrom> Note also how it is never "instance Functor (Maybe a)". It's "instance Functor Maybe", period, full-stop, no "a".
22:28 <xmonader2> So when creating instances i go with (arguments - 1)?
22:29 <monochrom> Yes for now.
22:33 ego joined
22:44 asdf__ joined
22:45 hiratara joined
22:47 gibbers joined
22:50 t0by joined
22:50 t0by joined
22:54 EO_ left
22:56 conal joined
23:12 NoCreativity joined
23:26 martingale joined
23:32 binaryplease joined
23:38 gibbers joined
23:54 Pupnik joined
23:55 aarvar joined
23:57 conal joined