Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 466 467 468 469 470 471 472 473 474 475 476 .. 5022
502,152 events total
2020-10-06 14:23:26 <John20> Hi All, is it correct to say that Haskell language extensions increase the space of valid 'haskell' programs? e.g. if a program is valid in core haskell, it will also be valid with extension A switched on?
2020-10-06 14:23:26 <quazimod1> im trying to imagine a type that's a functor but not a type function
2020-10-06 14:23:36 × jonatanb quits (~jonatanb@79.184.190.239.ipv4.supernova.orange.pl) (Quit: Leaving...)
2020-10-06 14:23:39 <ski> quazimod1 : if you define `data TernaryMaybe a = None | Kinda a | Just a', then `TernaryMaybe' is a functor
2020-10-06 14:23:40 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-10-06 14:23:53 <ski> but perhaps you wanted `Kinda' and `Just' to hold items of different types ?
2020-10-06 14:24:13 <quazimod1> TernaryMaybe is weird
2020-10-06 14:24:26 <sm[m]> broadly but not 100% true I think, John20
2020-10-06 14:24:32 <ski> maerwald : yea, there's something to be said for that. <https://en.wikipedia.org/wiki/Rule_of_least_power>
2020-10-06 14:24:40 <quazimod1> i wonder if you could throw in an fmap that takes more than 1 function
2020-10-06 14:25:04 <maerwald> ski: that rule isn't popular in here :p
2020-10-06 14:25:25 × Tops2 quits (~Tobias@dyndsl-095-033-093-242.ewe-ip-backbone.de) (Ping timeout: 240 seconds)
2020-10-06 14:25:27 × frdg quits (60e94035@pool-96-233-64-53.bstnma.fios.verizon.net) (Remote host closed the connection)
2020-10-06 14:25:29 <ski> John20 : mostly. some extensions introduce new keywords, though, which can't be used as identifiers then
2020-10-06 14:25:47 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 240 seconds)
2020-10-06 14:26:14 frdg joins (60e94035@pool-96-233-64-53.bstnma.fios.verizon.net)
2020-10-06 14:26:24 <quazimod1> ok it's 1am in sleepy sydney
2020-10-06 14:26:26 acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net)
2020-10-06 14:26:36 <quazimod1> time for me to hit the hay, have to wrestle a kangaroo tomorrow
2020-10-06 14:26:37 <ski> maerwald : it's about the tradeoff between expressiveness / expressive power (/ "cavalier power") and "reasonability" / reasoning (including refactoring) power (/ "predictive power")
2020-10-06 14:27:04 × Tops21 quits (~Tobias@dyndsl-095-033-093-242.ewe-ip-backbone.de) (Ping timeout: 256 seconds)
2020-10-06 14:27:26 <ski> quazimod1 : "i wonder if you could throw in an fmap that takes more than 1 function" -- see `Bifunctor',`Difunctor' (hrm, `Profunctor' ..)
2020-10-06 14:27:30 <ski> @type bimap
2020-10-06 14:27:32 <lambdabot> Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
2020-10-06 14:27:40 <ski> @type dimap
2020-10-06 14:27:41 <lambdabot> Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d
2020-10-06 14:27:45 <John20> Thanks sm[m] and ski. That answers my question
2020-10-06 14:27:57 <ski> > bimap (* 2) show (3,4)
2020-10-06 14:27:57 nbloomf joins (~nbloomf@2600:1700:83e0:1f40:1da1:2732:bb9f:da76)
2020-10-06 14:28:00 <lambdabot> (6,"4")
2020-10-06 14:28:12 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 256 seconds)
2020-10-06 14:29:08 voyons_osti joins (~dan@107-190-41-58.cpe.teksavvy.com)
2020-10-06 14:29:20 × xerox_ quits (~xerox@unaffiliated/xerox) (Ping timeout: 258 seconds)
2020-10-06 14:29:22 <ski> > dimap (+ 2) (+ 2) (^ 2) 3
2020-10-06 14:29:25 <lambdabot> 27
2020-10-06 14:30:20 <quazimod1> that's cool
2020-10-06 14:30:38 <ski> quazimod1 : "im trying to imagine a type that's a functor but not a type function" -- all functors are type functions. but not necessarily vice versa. e.g. `Endo',`IORef',`Comparision' (with `type Comparision a = a -> a -> Ordering')
2020-10-06 14:30:40 bahamas joins (~lucian@unaffiliated/bahamas)
2020-10-06 14:31:13 <ski> quazimod1 : anyway, good night, and have fun with programming, whether in Haskell or otherwhere :)
2020-10-06 14:31:32 <quazimod1> btw profunctor is cool
2020-10-06 14:31:39 <quazimod1> i hadn't considered that
2020-10-06 14:31:55 <ski> note how it goes in "opposite direction" in one type parameter
2020-10-06 14:32:03 <quazimod1> i cant imagine a specific use but i'm sure ive come across that
2020-10-06 14:32:05 <quazimod1> yeah
2020-10-06 14:32:16 <quazimod1> that's neat
2020-10-06 14:32:18 <ski> that's known as being "contravariant". there's `Contrafunctor' for contravariant functors (ordinary ones are covariant)
2020-10-06 14:32:30 <quazimod1> and like i said, i'm sure there are places where this abstraction could have been a neat solution
2020-10-06 14:32:37 <ski> contravariant functors are "consumers". covariant ones are producers
2020-10-06 14:32:44 snakemas1 joins (~snakemast@213.100.206.23)
2020-10-06 14:32:49 × ralejs quits (~ralejs@2620:10d:c093:400::5:2842) (Read error: Connection reset by peer)
2020-10-06 14:33:01 <quazimod1> i dont understand the consumer/producer thing
2020-10-06 14:33:01 <ski> a bifunctor is covariant in both parameters. a difunctor (cough, "profunctor") is contravariant in one parameter, and covariant in the other
2020-10-06 14:33:15 ralejs joins (~ralejs@2620:10d:c093:400::5:2842)
2020-10-06 14:33:23 <ski> (covariance and contravariance also crops up, with subtyping in OOP)
2020-10-06 14:33:46 <ski> consider `Tree a', this "produces `a's" in the sense that you can get `a' elements from it
2020-10-06 14:33:58 hackage libfuse3 0.1.1.1 - A Haskell binding for libfuse-3.x https://hackage.haskell.org/package/libfuse3-0.1.1.1 (yohashi)
2020-10-06 14:34:00 <quazimod1> sure
2020-10-06 14:34:06 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 272 seconds)
2020-10-06 14:34:12 <ski> `Maybe a' is similar, and so is `IO a' (although you can't "escape" from `IO'). you can still `fmap' over `IO', though
2020-10-06 14:34:27 × toorevitimirp quits (~tooreviti@117.182.180.245) (Ping timeout: 240 seconds)
2020-10-06 14:34:31 <quazimod1> sure
2020-10-06 14:34:41 <ski> but if you have `type Predicate a = a -> Bool', then a `Predicate a' is a consumer of `a's, not a producer (same for `Comparision' above)
2020-10-06 14:34:46 <quazimod1> also, for another time, i do not understand why you cant 'escape' from IO
2020-10-06 14:35:02 toorevitimirp joins (~tooreviti@117.182.180.245)
2020-10-06 14:35:11 jle` joins (~mstksg@cpe-23-240-75-236.socal.res.rr.com)
2020-10-06 14:35:12 × jle` quits (~mstksg@cpe-23-240-75-236.socal.res.rr.com) (Changing host)
2020-10-06 14:35:12 jle` joins (~mstksg@unaffiliated/mstksg)
2020-10-06 14:35:22 <ski> another example is something like `newtype Sink a = MkSink (a -> IO ())', that's used to throw `a' values to somewhere else, perhaps in another concurrently executing thread. that's also contravariant
2020-10-06 14:35:41 <quazimod1> oh i see what you mean
2020-10-06 14:35:43 ddellacosta joins (~dd@86.106.121.168)
2020-10-06 14:36:06 <ski> if you have a `Chan a', that's a concurrent channel that you can both write to, and read from, from different threads
2020-10-06 14:36:31 <ski> sometimes it may be good to "separate" the read and the write ends, so that you have `ReadChan a' to read `a's from, and `WriteChan a' to write `a's to
2020-10-06 14:36:59 <ski> `ReadChan' can be made into a (covariant) functor (so `Functor'), while `WriteChan' can be made into a contravariant functor (`Contrafunctor')
2020-10-06 14:37:32 <ski> you can do the same thing with references to mutable cells, like `IORef',`IOArray',`MVar', have separate read and write interfaces to them
2020-10-06 14:37:55 <ski> the point of doing this, is if you want to ensure that one part of the program can only read from it, and another part of the program can only write to it
2020-10-06 14:38:17 <quazimod1> I think that I understand
2020-10-06 14:38:36 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 260 seconds)
2020-10-06 14:39:09 <ski> (i think people doesn't do this, that commonly, but it could be done. being able to `fmap' or `contramap' (for contravariant functors) over them could be handy, in some cases. `Chan',`IORef',`IOArray i' are not functors at all, neither covariant nor contravariant, you can't "map" over them)
2020-10-06 14:42:19 <quazimod1> this all makes sense
2020-10-06 14:42:21 <quazimod1> also i really should seep!
2020-10-06 14:42:31 × lorozic quits (~lorozic@wks-41-812.mpi-sws.org) (Quit: Leaving)
2020-10-06 14:42:32 <quazimod1> peace, tomorrow!
2020-10-06 14:42:33 <ski> have fun !
2020-10-06 14:42:37 × datajerk quits (~datajerk@sense.net) (Quit: ZNC 1.7.3 - https://znc.in)
2020-10-06 14:42:40 × jle` quits (~mstksg@unaffiliated/mstksg) (Ping timeout: 265 seconds)
2020-10-06 14:42:52 phaul joins (~phaul@ruby/staff/phaul)
2020-10-06 14:42:56 datajerk joins (~datajerk@sense.net)
2020-10-06 14:43:03 × pta2002 quits (~quassel@104.248.23.110) (Remote host closed the connection)
2020-10-06 14:44:11 pta2002 joins (~quassel@104.248.23.110)
2020-10-06 14:45:21 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-10-06 14:46:38 Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas)
2020-10-06 14:50:28 <hololeap> @unmtl StateT s (ErrorT e (ReaderT r m)) a
2020-10-06 14:50:28 <lambdabot> s -> r -> m (Either e (a, s))
2020-10-06 14:50:44 <hololeap> @unmtl ReaderT r (StateT s (ErrorT e m)) a
2020-10-06 14:50:44 <lambdabot> r -> s -> m (Either e (a, s))
2020-10-06 14:51:19 mmynsted[m] joins (mmynstedtc@gateway/shell/matrix.org/x-zaildyuiusfkwsag)
2020-10-06 14:52:44 <hololeap> so, where you place a ReaderT doesn't change anything except the order of input arguments?
2020-10-06 14:53:21 oisdk joins (~oisdk@2001:bb6:3329:d100:c982:e387:7052:58be)
2020-10-06 14:53:59 Guest18 joins (567e8866@gateway/web/cgi-irc/kiwiirc.com/ip.86.126.136.102)
2020-10-06 14:54:56 <ski> @unmtl ReaderT r (ContT o m) a

All times are in UTC.