Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,997 events total
2021-08-05 09:47:17 <[exa]> mastarija: any reason for the explicit `forall m` there?
2021-08-05 09:47:35 <mastarija> I used it in testing
2021-08-05 09:47:46 <mastarija> [exa], to add @m to nonempty
2021-08-05 09:47:51 <mastarija> forgot to remove it
2021-08-05 09:50:22 oxide joins (~lambda@user/oxide)
2021-08-05 09:50:39 <mastarija> I mean, I understand my way of overloading isn't ideal, but I'm working on it :D
2021-08-05 09:50:54 <[exa]> mastarija: wild guess: add functional dependencies to the types in `Check` typeclass
2021-08-05 09:51:13 × hiruji quits (~hiruji@user/hiruji) (Ping timeout: 258 seconds)
2021-08-05 09:51:13 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 258 seconds)
2021-08-05 09:51:38 <[exa]> otherwise the "ambiguity" basically means that there's a monad appearing somewhere inside that can't be unified with the `m` that gets out of it
2021-08-05 09:51:50 <mastarija> [exa], I thought of that, but I'm not really sure what should depend on what
2021-08-05 09:52:02 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 09:52:20 <[exa]> nah that was a wild guess, it probably wouldn't help with ambiguity either
2021-08-05 09:52:35 hiruji joins (~hiruji@user/hiruji)
2021-08-05 09:53:13 <mastarija> Hm... maybe I can use m1 m2 instead of just m everywhere and add m1~m2 constraint to the instance... although that's a stretch :D
2021-08-05 09:53:41 × jpds quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 244 seconds)
2021-08-05 09:53:45 <[exa]> that should be the same by definition
2021-08-05 09:53:53 <mastarija> ye
2021-08-05 09:54:07 <mastarija> I guess I should rework my type class
2021-08-05 09:54:24 <mastarija> a -> b -> c is not very unifying apparently
2021-08-05 09:54:43 <mastarija> But it was simple
2021-08-05 09:56:30 <[exa]> yeah I kindof guess that it can't unify the `m` that gets out with the `m`'s it's getting from the individual checks, certainly not from just looking at the definition of typeclass
2021-08-05 09:56:41 <[exa]> you might wanna specialize it a bit
2021-08-05 09:56:58 jpds joins (~jpds@gateway/tor-sasl/jpds)
2021-08-05 09:56:59 <[exa]> now it's a typeclass basically for any 2-param functions
2021-08-05 09:57:06 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-08-05 09:57:52 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 09:58:05 slavaqq joins (~slavaqq@sdmail.sdserver.cz)
2021-08-05 09:59:02 <mastarija> Yes. I have this case where I have the middle argument which can be either [v] or v, but that can happen in two other cases, so it's hard to make a more specialized type class...
2021-08-05 09:59:12 <mastarija> [exa], do we have something like Id on a type level?
2021-08-05 09:59:26 <mastarija> some type family which always return the type it was given
2021-08-05 10:00:07 × Pickchea quits (~private@user/pickchea) (Ping timeout: 245 seconds)
2021-08-05 10:00:19 <mastarija> Then I might be able to have param "t" which I could instantiate to either [] or Id
2021-08-05 10:02:58 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-08-05 10:03:47 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 10:07:29 <[exa]> mastarija: parametrize these things you want in with a type that the typeclass can send there
2021-08-05 10:07:30 jakalx parts (~jakalx@base.jakalx.net) ()
2021-08-05 10:09:03 <[exa]> eg `check :: a -> b -> c a` or so
2021-08-05 10:09:16 <[exa]> (type families to the rescue!)
2021-08-05 10:09:48 <mastarija> So I was thinking something like this: class Check m v x i e o c where check :: (v -> x) -> c (Validator m i e) -> Validator m v o
2021-08-05 10:09:58 <mastarija> Then I could make c either []
2021-08-05 10:10:04 <mastarija> or Id
2021-08-05 10:10:10 <[exa]> is it really polymorphic in 7 different dimensions?
2021-08-05 10:10:21 <mastarija> Yes :D
2021-08-05 10:10:28 <mastarija> So far
2021-08-05 10:10:32 <mastarija> this is a working version
2021-08-05 10:10:48 <mastarija> But yes, now that I think about it.
2021-08-05 10:12:00 <[exa]> anyway yeah when you have the validator inside, it should at least typecheck
2021-08-05 10:12:07 carbolymer_ is now known as carbolymer
2021-08-05 10:12:14 <mastarija> Btw, how does one send in unapplied list type constructor? Do I just write []?
2021-08-05 10:12:25 <[exa]> yap
2021-08-05 10:12:36 <[exa]> [a] is syntax sugar for ([] a)
2021-08-05 10:12:51 <mastarija> Ok, cool
2021-08-05 10:13:21 <[exa]> (at least the last time I checked, which might have been 2008-ish)
2021-08-05 10:14:00 ubert joins (~Thunderbi@91.141.45.149.wireless.dyn.drei.com)
2021-08-05 10:14:58 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-08-05 10:15:35 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 10:16:12 agua_pesada joins (~agua_pesa@2804:14c:8793:8e2f:48b4:3d09:2f3b:552b)
2021-08-05 10:16:32 <mastarija> Damn, I thought I could do something like this:
2021-08-05 10:16:33 <mastarija> type family Id x where Id x = x
2021-08-05 10:16:37 <mastarija> class Check m v x i e o c where
2021-08-05 10:16:40 <mastarija> check :: (v -> x) -> c (Validator m i e) -> Validator m v o
2021-08-05 10:16:45 <mastarija> instance Functor m => Check m v x x e (Maybe e) Id where
2021-08-05 10:17:29 <mastarija> But apparently type family has to be applied before it goes inside the instance
2021-08-05 10:17:33 <[exa]> programming in the type system is likely not going to bring you closer to a well inferring code :D
2021-08-05 10:17:44 <mastarija> Who cares, I'm having fun :D
2021-08-05 10:17:59 <[exa]> maybe an associated type would suffice, as with `transformers` ?
2021-08-05 10:18:12 <[exa]> or what'sthatcalled
2021-08-05 10:18:19 <mastarija> Yes, but then I will have to use type application again
2021-08-05 10:18:27 <mastarija> If I understand you correctly
2021-08-05 10:18:50 <mastarija> Hm.. I'll have to rework things a bit more I guess.
2021-08-05 10:20:54 <[exa]> don't you want to have the monad constraint directly in the typeclass?
2021-08-05 10:21:13 <[exa]> it's already written as 'm' there, I'd say it would be fishy if that wasn't at least applicative
2021-08-05 10:22:54 <mastarija> [exa], hm... I guess
2021-08-05 10:23:08 <mastarija> That might actually be a good idea
2021-08-05 10:23:25 <mastarija> Although I always try to give the weakest possible constraint
2021-08-05 10:23:25 × hiruji quits (~hiruji@user/hiruji) (Ping timeout: 258 seconds)
2021-08-05 10:23:47 <[exa]> mastarija: weakest possible constraint leaves the typesystem empty handed
2021-08-05 10:24:44 <mastarija> [exa], not really, why limit your self to a monad if Functor is equally valid
2021-08-05 10:24:45 lortabac joins (~lortabac@2a01:e0a:541:b8f0:1b28:45fb:240d:9a03)
2021-08-05 10:25:05 <[exa]> it allows the TS to prove more stuff
2021-08-05 10:25:50 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds)
2021-08-05 10:25:59 <[exa]> the "constraints" should be read more like "assumptions" in this sense
2021-08-05 10:26:15 <[exa]> btw not sure if functor will work there, you want the stuff to fail right?
2021-08-05 10:27:06 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 10:27:46 × mousey quits (~skymouse@gateway/tor-sasl/mousey) (Remote host closed the connection)
2021-08-05 10:28:03 mousey joins (~skymouse@gateway/tor-sasl/mousey)
2021-08-05 10:28:42 kspalaiologos joins (~kspalaiol@user/kspalaiologos)
2021-08-05 10:30:22 Neuromancer joins (~Neuromanc@user/neuromancer)
2021-08-05 10:31:26 <mastarija> [exa], Sure, but that failure was already handled in the Validator, here I'm just transforming the input values
2021-08-05 10:32:14 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-08-05 10:32:19 <mastarija> Transforming a validator of some type x into a validator of a field from type v
2021-08-05 10:32:21 <[exa]> so Validators require at least applicatives?
2021-08-05 10:32:52 <mastarija> Yes
2021-08-05 10:33:01 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-05 10:33:19 hiruji joins (~hiruji@user/hiruji)
2021-08-05 10:34:32 × ubert quits (~Thunderbi@91.141.45.149.wireless.dyn.drei.com) (Ping timeout: 258 seconds)
2021-08-05 10:36:28 jakalx joins (~jakalx@base.jakalx.net)
2021-08-05 10:38:22 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 258 seconds)
2021-08-05 10:38:54 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)

All times are in UTC.