2024/05/09

Newest at the top

2024-05-09 21:08:27 +0200justsomeguylooks up Haskell meetups in Tampa
2024-05-09 21:08:07 +0200 <justsomeguy> I wish I could meet you all in person. It's a great group of people in this channel.
2024-05-09 21:07:15 +0200 <kaol> It's one of my favorite GHC features.
2024-05-09 21:04:26 +0200Axman6(~Axman6@user/axman6)
2024-05-09 21:04:15 +0200Axman6(~Axman6@user/axman6) (Remote host closed the connection)
2024-05-09 20:59:12 +0200 <justsomeguy> Also I just found out I can do deriving Functor!
2024-05-09 20:57:46 +0200titiband`titibandit
2024-05-09 20:55:32 +0200 <justsomeguy> Thanks everyone for your help, I was pretty slow on the uptake there.
2024-05-09 20:54:58 +0200 <justsomeguy> :D
2024-05-09 20:54:54 +0200 <EvanR> I mean let the static types guide you
2024-05-09 20:54:34 +0200 <EvanR> with dynamic types anything can be anythinged, but we have static types which must be respected!
2024-05-09 20:53:35 +0200 <EvanR> fmapping both wouldn't make sense
2024-05-09 20:53:25 +0200 <lambdabot> ("foo",False)
2024-05-09 20:53:24 +0200 <EvanR> > fmap even ("foo", 99)
2024-05-09 20:53:17 +0200 <EvanR> dammit
2024-05-09 20:53:11 +0200 <lambdabot> from the context: Num a
2024-05-09 20:53:11 +0200 <lambdabot> • Could not deduce (Integral [Char]) arising from a use of ‘even’
2024-05-09 20:53:11 +0200 <lambdabot> error:
2024-05-09 20:53:09 +0200 <EvanR> > fmap even (99, "foo")
2024-05-09 20:52:24 +0200 <justsomeguy> Alright, I was misreading the result of (fmap (+10) (Left 1)), and that was confusing because I thought I could fmap both constructors. But it wasn't.
2024-05-09 20:52:24 +0200ocra8(ocra8@user/ocra8)
2024-05-09 20:51:56 +0200 <kaol> Putting them inside a 2-tuple won't have anything to do with Bifunctor either.
2024-05-09 20:51:47 +0200 <ski> no `Bifunctor' there ^
2024-05-09 20:51:40 +0200 <lambdabot> Functor f => (a -> b) -> f a -> f b
2024-05-09 20:51:39 +0200 <ski> @type fmap
2024-05-09 20:51:18 +0200 <ski> justsomeguy : `fmap' means `Functor', not `Bifunctor'
2024-05-09 20:50:59 +0200 <ncf> you're not using the Bifunctor instance there, just Functor (Either a)
2024-05-09 20:50:58 +0200 <ski> (i didn't fix your code, i just added the correct type signature, for clarity)
2024-05-09 20:50:36 +0200titiband`(~titiband`@user/titibandit)
2024-05-09 20:50:21 +0200 <ski> justsomeguy : <https://termbin.com/nxth>
2024-05-09 20:50:14 +0200 <justsomeguy> OK. Why does (fmap (+10) (Left 1), fmap (+10) (Right 3)) work? Because it has an instance of Bifunctor?
2024-05-09 20:49:57 +0200titiband`(~titiband`@user/titibandit) (Remote host closed the connection)
2024-05-09 20:49:29 +0200euleritian(~euleritia@dynamic-176-002-128-182.176.2.pool.telefonica.de)
2024-05-09 20:48:55 +0200 <ncf> you obviously cannot apply a function a -> b to a field that doesn't have type a
2024-05-09 20:48:34 +0200 <ncf> there's only one possible instance
2024-05-09 20:47:39 +0200 <justsomeguy> Oh... the instance in base for Functor (Either a) only works on one constructor, too.
2024-05-09 20:47:02 +0200julie_pilgrim(~julie_pil@user/julie-pilgrim/x-1240752) (Remote host closed the connection)
2024-05-09 20:46:06 +0200titiband`(~titiband`@user/titibandit)
2024-05-09 20:44:49 +0200euleritian(~euleritia@dynamic-176-002-128-182.176.2.pool.telefonica.de) (Ping timeout: 272 seconds)
2024-05-09 20:44:35 +0200 <EvanR> imagine if you had a type system for every goal
2024-05-09 20:44:16 +0200 <EvanR> justsomeguy, what you call "not working" I call working great. I.e. the type system stopped you from doing the objectively wrong thing
2024-05-09 20:41:55 +0200 <ski> (if you enable `InstanceSigs' as suggested above, you can write that type signature for `fmap' directly into that `instance' declaration for `Functor')
2024-05-09 20:41:01 +0200 <ski> long story short, you're not correctly implementing the expected type signature
2024-05-09 20:40:42 +0200 <ski> (but then your actual code for `fmap' doesn't currently implement that correctly, hence the type error)
2024-05-09 20:40:34 +0200 <justsomeguy> I'm not gonna lie, this is going over my head
2024-05-09 20:39:58 +0200 <ski> in general, `fmap :: (a -> c) -> (f a -> f c)'. you have `Functor (BahEither b)' meaning that `f = `BahEither b', so you get `fmap :: (a -> c) -> (BahEither b a -> BahEither b c)'
2024-05-09 20:38:11 +0200 <dolio> It has to do that because the type of the Left changes.
2024-05-09 20:38:06 +0200 <ski> you have `BahEither b a', where `PLeft' takes an `a', and `PRight' takes a `b' .. so the opposite way around
2024-05-09 20:38:02 +0200 <dolio> Do you mean it has cases for both Left and Right?
2024-05-09 20:37:57 +0200 <lambdabot> Right 2