Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 331 332 333 334 335 336 337 338 339 340 341 .. 5022
502,152 events total
2020-09-30 20:04:28 <nobody239419341> This is new to me, only seen it on signatures and case expressions, and reverse form on do blocks
2020-09-30 20:04:43 <sm[m]> tomsmeding: they seem to be on top of things.. nice precision
2020-09-30 20:05:20 <sm[m]> oh, well "I have no idea which, if any, of the following licenses apply, so I've copied them all.", maybe precision is not the word :)
2020-09-30 20:05:37 <sm[m]> nice transparency
2020-09-30 20:06:06 eyenx joins (~eyenxeyen@unaffiliated/eye/x-1653358)
2020-09-30 20:06:11 kish joins (~oracle@unaffiliated/oracle)
2020-09-30 20:06:37 <kindaro> tomsmeding, so I may transform `Type` to an `Exp` that contains the corresponding type constructor, and then I can use it to obtain an expression for its `tyConName`.
2020-09-30 20:06:55 <kindaro> tomsmeding  Does this explanation make things clearer?
2020-09-30 20:07:09 <Cheery> nobody239419341: Well I can tell you it's hard, and my explanation may go over, if that's the case, I'll try to elaborate so you understand it enough.
2020-09-30 20:07:26 <tomsmeding> kindaro: if the type in question is data A = B | C, do you want, "A", "B" or "C"?
2020-09-30 20:07:35 <kindaro> `A`.
2020-09-30 20:07:39 <tomsmeding> okay
2020-09-30 20:07:47 <Cheery> nobody239419341: but the important part now is, you need to look at the function type like that.
2020-09-30 20:07:48 <nobody239419341> i can't even say if I know precisely what's a typeclass and type and data and whatever things in haskell
2020-09-30 20:07:58 <kindaro> tomsmeding  I cannot really obtain anything else from `reifyInstances°.
2020-09-30 20:07:59 <Cheery> :t (>>=)
2020-09-30 20:08:01 <tomsmeding> is it hard to give a piece of code that contains one `_` hole where you don't know what function to insert?
2020-09-30 20:08:01 <lambdabot> Monad m => m a -> (a -> m b) -> m b
2020-09-30 20:08:23 <Cheery> nobody239419341: you see how that type signature goes, now you can expand here.. You had..
2020-09-30 20:08:45 <Cheery> nobody239419341: m [a] -> ([a] -> m b) -> m b
2020-09-30 20:08:54 olliey joins (5f92092d@95.146.9.45)
2020-09-30 20:08:59 <nobody239419341> yeah It's just I think about an Num when I see Monad so I imagine like Its like Num m => Num a (a -> .... etc
2020-09-30 20:09:19 <Cheery> so if you do (>>=) reverse, we got this..
2020-09-30 20:09:23 <Cheery> :t (>>=) reverse
2020-09-30 20:09:24 <lambdabot> ([a] -> [a] -> b) -> [a] -> b
2020-09-30 20:09:49 <Cheery> the next parameter is a function, and now it has expanded like that.. so the first parameter is the result of 'reverse', what else could it be?
2020-09-30 20:10:01 <nobody239419341> okay go on, I have one question to ask at the end or now, if you like
2020-09-30 20:10:04 <Cheery> the second parameter is the argument passed to reverse.
2020-09-30 20:10:09 <kindaro> tomsmeding  `getTypeNameLiteral subject = _ [|(tyConName ∘ typeRepTyCon) (typeRep @ $(return subject))|] ∷ Q Pat`
2020-09-30 20:10:42 ransom joins (~c4264035@c-73-243-2-10.hsd1.co.comcast.net)
2020-09-30 20:10:57 DataComputist joins (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net)
2020-09-30 20:10:59 filwisher joins (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net)
2020-09-30 20:11:30 × geekosaur quits (42d52102@66.213.33.2) (Remote host closed the connection)
2020-09-30 20:11:34 <Cheery> nobody239419341: so if you take [1,2] == [2,1] it's bit like checking whether [1,2] is a palindrome?
2020-09-30 20:11:45 <nobody239419341> yes
2020-09-30 20:11:46 mirrorbird joins (~psutcliff@m83-187-182-226.cust.tele2.se)
2020-09-30 20:12:00 <nobody239419341> :t (>>=)
2020-09-30 20:12:02 <lambdabot> Monad m => m a -> (a -> m b) -> m b
2020-09-30 20:12:05 <Cheery> nobody239419341: so if you put it there, like this: (>>=) reverse (==)
2020-09-30 20:12:22 × mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-30 20:12:23 <Cheery> you get this kind of composition of reverse with that function of checking equality of two lists.
2020-09-30 20:12:28 × eyenx quits (~eyenxeyen@unaffiliated/eye/x-1653358) (Quit: killed)
2020-09-30 20:12:45 mu_ joins (~mu@unaffiliated/mu)
2020-09-30 20:12:52 <Cheery> :t (>>=) reverse (==)
2020-09-30 20:12:54 <lambdabot> Eq a => [a] -> Bool
2020-09-30 20:13:18 <ski> @type (>>=) `asTypeIn` \(>>=) -> (>>=) reverse (==)
2020-09-30 20:13:20 <lambdabot> Eq a => ([a] -> [a]) -> ([a] -> [a] -> Bool) -> [a] -> Bool
2020-09-30 20:14:01 <Cheery> cool.
2020-09-30 20:15:02 <ski> > (>>=) f (g :: Expr -> Expr -> Expr) x
2020-09-30 20:15:05 <lambdabot> g (f x) x
2020-09-30 20:15:37 eyenx joins (~eyenxeyen@unaffiliated/eye/x-1653358)
2020-09-30 20:16:03 <nobody239419341> thank you Cheery. It helped a bit
2020-09-30 20:16:40 tchouri joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
2020-09-30 20:17:05 <Cheery> nobody239419341: Also check out ski's explanation, but the idea is that functions are valid monads and that thing kind of treats reverse as a monad, then binds the equality to it.
2020-09-30 20:17:08 tchouri is now known as hekkaidekapus
2020-09-30 20:17:14 ashbreeze joins (~mark@72-161-49-118.dyn.centurytel.net)
2020-09-30 20:18:12 <Cheery> it probably helps if you consider how functions are valid functors, or then it doesn't.
2020-09-30 20:19:28 <Cheery> @type fmap `asTypeIn` \fmap -> (fmap f g :: a -> b)
2020-09-30 20:19:29 <lambdabot> error:
2020-09-30 20:19:30 <lambdabot> • Couldn't match type ‘f’ with ‘(->) a1’
2020-09-30 20:19:30 <lambdabot> because type variable ‘a1’ would escape its scope
2020-09-30 20:19:33 × _ashbreeze_ quits (~mark@72-161-253-130.dyn.centurytel.net) (Ping timeout: 260 seconds)
2020-09-30 20:19:44 <ski> (not functions. functions are values, monads are not values. you mean the (partially applied function) type `([a] ->)', being a monad. so e.g. `(>>=) :: Monad m => m b -> (b -> m c) -> m c' then becomes `([a] -> b) -> (b -> [a] -> c) -> [a] -> c')
2020-09-30 20:20:12 <nobody239419341> wait this could be important information for me to understand
2020-09-30 20:20:16 <nobody239419341> so is all functions are types?
2020-09-30 20:20:46 knupfer joins (~Thunderbi@200116b82ca43f002c28ccfffeb57fee.dip.versatel-1u1.de)
2020-09-30 20:20:47 × knupfer quits (~Thunderbi@200116b82ca43f002c28ccfffeb57fee.dip.versatel-1u1.de) (Client Quit)
2020-09-30 20:20:50 <p0a> yeah nobody239419341
2020-09-30 20:20:54 × edwtjo quits (~edwtjo@fsf/member/edwtjo) (Ping timeout: 258 seconds)
2020-09-30 20:20:58 knupfer joins (~Thunderbi@200116b82ca43f005c40053ed66b0b42.dip.versatel-1u1.de)
2020-09-30 20:21:10 <ski> @type fmap `asTypeIn` \fmap -> fmap ?f ?g
2020-09-30 20:21:12 <lambdabot> (Functor f, ?f::a -> b, ?g::f a) => (a -> b) -> f a -> f b
2020-09-30 20:21:18 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 260 seconds)
2020-09-30 20:21:32 <ski> nobody239419341 : functions are not types
2020-09-30 20:21:36 mahene joins (~mahene@2a02:8109:86c0:8d68:5400:2bfd:d746:732c)
2020-09-30 20:21:43 <Cheery> (a -> b) -> (c -> a) -> (c -> b)
2020-09-30 20:21:48 <ski> "function types" means the types of functions
2020-09-30 20:22:02 alp joins (~alp@2a01:e0a:58b:4920:d4f2:e84:b07:a9f2)
2020-09-30 20:22:37 × mu_ quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-30 20:22:41 <nobody239419341> so how do you pass the reverse function as an argument to the (>>=) ?
2020-09-30 20:22:47 mu__ joins (~mu@unaffiliated/mu)
2020-09-30 20:23:21 <Cheery> nobody239419341: There's an instance Monad (a ->)
2020-09-30 20:23:31 <Cheery> it is matched when you do os.
2020-09-30 20:23:40 <p0a> nobody239419341: what is happening is a bit different than that. There's a lot of stuff going on involving definitions you probably are not even aware of
2020-09-30 20:23:57 <p0a> nobody239419341: to just compose two functions you do something like (f . g)
2020-09-30 20:24:20 AlterEgo- joins (~ladew@124-198-158-163.dynamic.caiway.nl)
2020-09-30 20:24:24 <monochrom> >>= is an infix operator, so just write "reverse >>= ..."?
2020-09-30 20:25:05 <Cheery> https://hackage.haskell.org/package/base-4.14.0.0/docs/src/GHC.Base.html#line-979
2020-09-30 20:25:07 <p0a> The trick with your palindrome implementation is that it uses a well-known feature of the language (monads), but also a less commonly used monad (the function monad). That's how I understand it. To understand the better known parts of monads, is already a task in itself nobody239419341
2020-09-30 20:25:31 × AlterEgo- quits (~ladew@124-198-158-163.dynamic.caiway.nl) (Client Quit)
2020-09-30 20:26:18 × John20 quits (~John@82.46.59.122) (Ping timeout: 272 seconds)
2020-09-30 20:26:37 × mahene quits (~mahene@2a02:8109:86c0:8d68:5400:2bfd:d746:732c) (Quit: Leaving)
2020-09-30 20:27:13 × ashbreeze quits (~mark@72-161-49-118.dyn.centurytel.net) (Ping timeout: 260 seconds)
2020-09-30 20:27:17 <nobody239419341> uh why nobody can explain like just an example -> it takes the reverse function and puts it on the right side of the (==) and whenever a list is called on it, list will put on left side of the (==) and reverse will be applied and put it on the right side
2020-09-30 20:27:20 AlterEgo- joins (~ladew@124-198-158-163.dynamic.caiway.nl)
2020-09-30 20:27:58 hackage transformers-compat 0.6.6 - A small compatibility shim for the transformers library https://hackage.haskell.org/package/transformers-compat-0.6.6 (ryanglscott)
2020-09-30 20:28:01 <nobody239419341> Damn monads
2020-09-30 20:28:12 <monochrom> Huh? That explanation is BS.
2020-09-30 20:28:15 <Cheery> nobody239419341: it's lot of details that go into it becoming (==) (reverse x) x
2020-09-30 20:28:29 <p0a> monochrom: mine? Whoops, sorry

All times are in UTC.