Logs: liberachat/#haskell
| 2021-08-20 09:33:44 | <Guest610> | great |
| 2021-08-20 09:33:45 | <[exa]> | (+) takes 2 numeric arguments, `uncurry (+)` takes a 2-tuple argument of numeric stuff |
| 2021-08-20 09:33:46 | <Guest610> | thanks |
| 2021-08-20 09:34:38 | <Guest610> | map (uncurry (+)) [(1,2,3), (5,6,8)] |
| 2021-08-20 09:34:58 | <Guest610> | >map (uncurry (+)) [(1,2,3), (5,6,8)] |
| 2021-08-20 09:36:11 | <Guest610> | ok.. |
| 2021-08-20 09:36:19 | <[exa]> | probably needs the space behind > |
| 2021-08-20 09:36:44 | <[exa]> | anyways this will fail because (+) only takes 2 arguments, not 3 |
| 2021-08-20 09:37:54 | <[exa]> | anyway, fun extra exercise: 1] construct `zip` from `zipWith` (that should be easy), and 2] construct `zipWith` from `map`,`zip`,and `uncurry` (that's a bit harder) |
| 2021-08-20 09:39:35 | → | trcc joins (~trcc@users-5343.st.net.au.dk) |
| 2021-08-20 09:41:28 | <[exa]> | Guest610: btw your sample needs uncurrying to 3-tuples, which lambdabot doesn't have loaded apparently, so: |
| 2021-08-20 09:41:59 | <[exa]> | > let sum3 a b c = a+b+c; uncurry3 f (a,b,c) = f a b c in map (uncurry3 sum3) [(1,2,3), (2,3,4)] |
| 2021-08-20 09:42:01 | <lambdabot> | [6,9] |
| 2021-08-20 09:45:14 | × | jpds quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
| 2021-08-20 09:45:46 | → | jpds joins (~jpds@gateway/tor-sasl/jpds) |
| 2021-08-20 09:45:56 | → | random-jellyfish joins (~random-je@user/random-jellyfish) |
| 2021-08-20 09:46:50 | <Guest610> | ..thanks |
| 2021-08-20 09:48:45 | × | Guest610 quits (~Guest6@115.98.232.12) (Quit: Client closed) |
| 2021-08-20 09:49:21 | × | kilolympus quits (~kilolympu@cpc92710-cmbg20-2-0-cust265.5-4.cable.virginm.net) (Ping timeout: 248 seconds) |
| 2021-08-20 09:49:50 | → | oxide joins (~lambda@user/oxide) |
| 2021-08-20 09:51:58 | × | kstuart quits (~user@185.92.25.246) (Ping timeout: 250 seconds) |
| 2021-08-20 09:53:16 | × | shriekingnoise quits (~shrieking@186.137.144.80) (Quit: Quit) |
| 2021-08-20 09:54:40 | × | jespada quits (~jespada@90.254.247.46) (Ping timeout: 240 seconds) |
| 2021-08-20 09:56:15 | → | kilolympus joins (~kilolympu@cpc92710-cmbg20-2-0-cust265.5-4.cable.virginm.net) |
| 2021-08-20 09:56:17 | → | jespada joins (~jespada@90.254.247.46) |
| 2021-08-20 09:56:50 | × | oxide quits (~lambda@user/oxide) (Quit: oxide) |
| 2021-08-20 09:58:20 | → | oxide joins (~lambda@user/oxide) |
| 2021-08-20 09:58:36 | → | tengu1 joins (~tengu1@cpe-70-121-244-14.neb.res.rr.com) |
| 2021-08-20 10:01:02 | × | oxide quits (~lambda@user/oxide) (Client Quit) |
| 2021-08-20 10:01:35 | → | oxide joins (~lambda@user/oxide) |
| 2021-08-20 10:05:03 | × | oxide quits (~lambda@user/oxide) (Client Quit) |
| 2021-08-20 10:06:00 | → | oxide joins (~lambda@user/oxide) |
| 2021-08-20 10:10:25 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection) |
| 2021-08-20 10:10:28 | × | random-jellyfish quits (~random-je@user/random-jellyfish) (Ping timeout: 246 seconds) |
| 2021-08-20 10:10:51 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-20 10:21:38 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection) |
| 2021-08-20 10:22:04 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-20 10:26:10 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 240 seconds) |
| 2021-08-20 10:28:55 | → | o1lo01ol1o joins (~o1lo01ol1@bl13-86-242.dsl.telepac.pt) |
| 2021-08-20 10:29:32 | × | o1lo01ol1o quits (~o1lo01ol1@bl13-86-242.dsl.telepac.pt) (Remote host closed the connection) |
| 2021-08-20 10:29:44 | → | o1lo01ol1o joins (~o1lo01ol1@bl13-86-242.dsl.telepac.pt) |
| 2021-08-20 10:32:00 | × | oxide quits (~lambda@user/oxide) (Quit: oxide) |
| 2021-08-20 10:32:31 | → | Lycurgus joins (~juan@cpe-45-46-140-49.buffalo.res.rr.com) |
| 2021-08-20 10:35:42 | × | ablutor quits (~quassel@wasscher.com) (Quit: going for vitamine d) |
| 2021-08-20 10:36:30 | → | ablutor joins (~quassel@wasscher.com) |
| 2021-08-20 10:36:42 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 2021-08-20 10:36:44 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 2021-08-20 10:37:10 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 2021-08-20 10:38:31 | × | fendor quits (~fendor@213162073025.public.t-mobile.at) (Remote host closed the connection) |
| 2021-08-20 10:41:00 | → | oxide joins (~lambda@user/oxide) |
| 2021-08-20 10:54:50 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-20 10:56:44 | <mastarija> | Can someone remind me what's it called when we can have a valid e.g. "Monad" instance if only we could put a constraint on the "inner" type? |
| 2021-08-20 10:56:56 | <mastarija> | Constrained instances, bound instances...? |
| 2021-08-20 10:57:34 | <Rembane_> | Is it a scoped instance? |
| 2021-08-20 10:57:38 | <dminuoso> | mastarija: I dont understand the question entirely. |
| 2021-08-20 10:57:41 | <dminuoso> | Can you give a concrete example? |
| 2021-08-20 10:58:03 | <mastarija> | Hm... let's say I could make an Applicative instance |
| 2021-08-20 10:58:34 | <mastarija> | But only if the target e.g. instance Monoid n => Applicative (MyType n) where |
| 2021-08-20 10:59:02 | <mastarija> | And MyType : * -> * |
| 2021-08-20 10:59:13 | <mastarija> | not * -> * -> * |
| 2021-08-20 10:59:57 | <mastarija> | Basically, I could make an Applicative instance if only I can constrain the argument of MyType |
| 2021-08-20 11:00:00 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-08-20 11:00:02 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection) |
| 2021-08-20 11:00:29 | <dminuoso> | mastarija: From a type checker point of view you have an `Applicative` instance for all n of `MyType n` |
| 2021-08-20 11:00:45 | <dminuoso> | It just defers the `Monoid n` constraint to somewhere else |
| 2021-08-20 11:01:02 | → | alx741 joins (~alx741@181.196.69.234) |
| 2021-08-20 11:01:11 | <mastarija> | I mean, it's not possible to do what I want with standard type classes |
| 2021-08-20 11:01:44 | <mastarija> | There's a library with constrained type classes for that purpose, but my brain can't recall what it is called |
| 2021-08-20 11:03:14 | <dminuoso> | mastarija: You can observe this fact since it would match that instance for `Applicative (MyType Int)`, even if there's no `Monoid Int` |
| 2021-08-20 11:03:40 | <dminuoso> | So the constraint does not constrain the instance itself |
| 2021-08-20 11:04:08 | <mastarija> | I want to use e.g. "mempty" within my implementation of "Applicative" instance |
| 2021-08-20 11:04:41 | <dminuoso> | Maybe my wording slightly off. |
| 2021-08-20 11:04:42 | <mastarija> | And I want to have "Applicative" instance for all "MyType n" |
| 2021-08-20 11:05:01 | → | drsocks joins (~aaashutos@113.199.180.28) |
| 2021-08-20 11:05:17 | <mastarija> | dminuoso, Maybe it's me, didn't get enough sleep today :D |
| 2021-08-20 11:05:38 | → | random-jellyfish joins (~random-je@user/random-jellyfish) |
| 2021-08-20 11:05:46 | × | drsocks quits (~aaashutos@113.199.180.28) (Client Quit) |
| 2021-08-20 11:06:11 | <alp> | mastarija, constrained is the right term I think. see e.g https://hackage.haskell.org/package/constrained-monads |
| 2021-08-20 11:06:57 | <mastarija> | alp, ah yes.. |
| 2021-08-20 11:07:01 | <mastarija> | that's it |
| 2021-08-20 11:07:22 | <alp> | i.e your MyType is a monad or applicative or something only if the type parameters it will get satisfy some constraint |
| 2021-08-20 11:07:32 | <mastarija> | Yes |
| 2021-08-20 11:07:47 | <dminuoso> | alp: Mmm, so this would allow us to have Monad for Set? |
| 2021-08-20 11:07:50 | <alp> | eg what one would want for Set to be a functor/applicative/monad, because of the Ord |
| 2021-08-20 11:07:56 | <dminuoso> | Neat! |
| 2021-08-20 11:08:13 | <dminuoso> | I thought we needed quantified constraints for that |
| 2021-08-20 11:08:18 | <dminuoso> | Maybe I misremembered |
| 2021-08-20 11:08:21 | <alp> | dminuoso, indeed: https://hackage.haskell.org/package/constrained-monads-0.5.0.0/docs/src/Control-Monad-Constrained.html#line-892 |
| 2021-08-20 11:10:30 | × | vpan quits (~vilius@212.117.1.172) (Quit: Leaving.) |
| 2021-08-20 11:10:37 | <alp> | dminuoso, I don't think that'd be enough. because the fmap you'd have to implement (with the standard Functor class) would still be required to have type forall a b. (a -> b) -> Set a -> Set b, no Ord in sight |
| 2021-08-20 11:11:46 | → | acidjnk_new joins (~acidjnk@p200300d0c72b9557dc14868c6ad3e278.dip0.t-ipconnect.de) |
| 2021-08-20 11:11:56 | <alp> | whereas this whole constrained line of thinking lets you specify a suitable constraint that's "made available to you" when you implement the method |
| 2021-08-20 11:12:32 | <mastarija> | Hm... is it possible to implement the Unconstrained version of e.g. Functor using the constrained version? |
| 2021-08-20 11:12:37 | <dminuoso> | Presumably it just reifies the dict with `constraints` and gives it to you |
| 2021-08-20 11:14:51 | <mastarija> | It seems like it would be possible to do it as long as we do e.g. "instance Constrained.Functor f => UnConstrainde.Functor f where {use constrained methods to implement uncinstrained methods}" |
| 2021-08-20 11:14:51 | × | acidjnk_new3 quits (~acidjnk@p200300d0c72b950070172e7c3c578523.dip0.t-ipconnect.de) (Ping timeout: 258 seconds) |
| 2021-08-20 11:14:51 | <arahael> | Hmph, it seems I can't use hip in haskell 8.10. |
| 2021-08-20 11:16:32 | <alp> | mastarija, calling the constrained methods will bring up e.g the Ord constraints for Set, that you'll never have available when implementing the unconstrained variant. fmap :: forall a b. (a -> b) -> Set a -> Set b is the type your unconstrained implementation needs to have, which (kinda purposefully) prevents you from assuming anything about 'a' and 'b'. |
| 2021-08-20 11:16:32 | × | xsarnik quits (xsarnik@lounge.fi.muni.cz) (Remote host closed the connection) |
| 2021-08-20 11:17:39 | <mastarija> | Ah.. yes. Now that I think about it |
All times are in UTC.