Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-24 15:22:33 × dbmikus quits (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) (Ping timeout: 245 seconds)
2021-03-24 15:23:22 Major_Biscuit joins (~Major_Bis@82-169-100-198.biz.kpn.net)
2021-03-24 15:25:06 × xff0x quits (~xff0x@2001:1a81:53c9:9f00:6a34:c608:ac81:347c) (Ping timeout: 268 seconds)
2021-03-24 15:25:36 xff0x joins (~xff0x@2001:1a81:53c9:9f00:27ac:86d9:28a4:2240)
2021-03-24 15:25:36 × zebrag quits (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!)
2021-03-24 15:25:50 × jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 264 seconds)
2021-03-24 15:25:57 zebrag joins (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr)
2021-03-24 15:27:01 is_null joins (~jpic@pdpc/supporter/professional/is-null)
2021-03-24 15:29:39 myShoggoth joins (~myShoggot@75.164.81.55)
2021-03-24 15:30:23 Waifod joins (~Waifod@91.106.123.186)
2021-03-24 15:31:20 s00pcan joins (~chris@075-133-056-178.res.spectrum.com)
2021-03-24 15:31:43 × thc202 quits (~thc202@unaffiliated/thc202) (Read error: Connection reset by peer)
2021-03-24 15:32:54 × idhugo_ quits (~idhugo@80-62-117-136-mobile.dk.customer.tdc.net) (Ping timeout: 256 seconds)
2021-03-24 15:33:35 jamm_ joins (~jamm@unaffiliated/jamm)
2021-03-24 15:34:23 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-03-24 15:35:50 <romesrf> and what's the "$" called?
2021-03-24 15:36:43 <peanut_> application
2021-03-24 15:37:22 <monochrom> root of all evil :)
2021-03-24 15:37:33 × s00pcan quits (~chris@075-133-056-178.res.spectrum.com) (Ping timeout: 272 seconds)
2021-03-24 15:37:35 × jb55 quits (~jb55@gateway/tor-sasl/jb55) (Ping timeout: 268 seconds)
2021-03-24 15:37:52 <romesrf> monochrom: T_T
2021-03-24 15:37:55 × jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 240 seconds)
2021-03-24 15:37:58 <romesrf> ahahaha
2021-03-24 15:38:08 s00pcan joins (~chris@107.181.165.217)
2021-03-24 15:38:09 <romesrf> peanut_: ty
2021-03-24 15:43:37 thc202 joins (~thc202@unaffiliated/thc202)
2021-03-24 15:44:34 jb55 joins (~jb55@gateway/tor-sasl/jb55)
2021-03-24 15:44:49 <marinelli> hi everyone
2021-03-24 15:45:27 <marinelli> some of you has some experience with TextShow?
2021-03-24 15:49:29 <tomsmeding> romesrf: https://hackage.haskell.org/package/base-4.14.0.0/docs/Prelude.html#v:-36-
2021-03-24 15:50:10 geekosaur joins (ac3a8f06@172.58.143.6)
2021-03-24 15:53:45 Mzg joins (Mzg@s1.ct8.pl)
2021-03-24 15:54:19 <ij> I would like to have a "data Foo" data type that could have two different inside of it which should be statically typed. i.e. not either
2021-03-24 15:54:30 × jb55 quits (~jb55@gateway/tor-sasl/jb55) (Remote host closed the connection)
2021-03-24 15:54:58 <merijn> ij: What's the problem?
2021-03-24 15:55:01 <ij> writing now
2021-03-24 15:55:13 heatsink joins (~heatsink@2600:1700:bef1:5e10:b09b:3609:dd4b:42c9)
2021-03-24 15:55:23 <ij> It's going to be a Map Int (Set a) vor a Map Int Int. At one point, I'll go over to Map Int (Set a), because I'll need more information later, but at the beginning I don't need it.
2021-03-24 15:55:57 <ij> the Int in values is going to be the Set size. First I'll just +1 or join (sum) them, later I'll insert elements or join sets
2021-03-24 15:56:29 <tomsmeding> data Foo a where FooCount :: Map Int Int -> Foo Int ; FooSet :: Map Int (Set a) -> Foo (Set a)
2021-03-24 15:56:39 <tomsmeding> or, just, use Map Int Int and Map Int (Set a) directly?
2021-03-24 15:57:17 <tomsmeding> or is the point that you want to write functions that work on both representations?
2021-03-24 15:57:33 <ij> you can have a data with where?
2021-03-24 15:57:40 <tomsmeding> make both types an instance of a typeclass that implements the required functionality?
2021-03-24 15:57:44 <tomsmeding> ij: that Foo I wrote is a GADT
2021-03-24 15:57:57 <tomsmeding> 'data Foo where' is GADT syntax
2021-03-24 15:58:09 <ij> ok, I'd never seen that
2021-03-24 15:58:27 <ij> I'd only seen "data Foo = A | B" without any where clause
2021-03-24 15:58:44 <tomsmeding> it allows you to let the constructor restrict the type parameters
2021-03-24 15:58:46 <tomsmeding> like here
2021-03-24 15:58:54 <peanut_> data Foo a = A | B always create a "Foo a"
2021-03-24 16:00:17 <tomsmeding> ij: I'm not convinced a type class can't solve your problems :)
2021-03-24 16:00:17 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-24 16:00:29 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-24 16:00:32 Sorny joins (~Sornaensi@077213203030.dynamic.telenor.dk)
2021-03-24 16:00:44 <ij> I was thinking that there's going to be a typeclass
2021-03-24 16:00:57 <romesrf> tomsmeding: nice! ty
2021-03-24 16:01:20 <ij> I was trying to program in my head while daydreaming and I was convinced I was missing something
2021-03-24 16:02:04 Sornaensis joins (~Sornaensi@79.142.232.102.static.router4.bolignet.dk)
2021-03-24 16:03:07 <ij> tomsmeding, could you whip that up in lambdabot?
2021-03-24 16:03:20 <tomsmeding> the type class thing?
2021-03-24 16:03:23 <ij> aha
2021-03-24 16:03:32 <tomsmeding> well the contents of the type class would kind of depend on what you're doing with those types :p
2021-03-24 16:03:59 tzh joins (~tzh@c-24-21-73-154.hsd1.wa.comcast.net)
2021-03-24 16:04:22 <tomsmeding> % class IJthing a where onlySmallOnes :: a -> a
2021-03-24 16:04:23 <yahb> tomsmeding:
2021-03-24 16:04:37 × Sorna quits (~Sornaensi@79.142.232.102) (Ping timeout: 258 seconds)
2021-03-24 16:04:56 <tomsmeding> % instance IJthing (Map Int Int) where onlySmallOnes = M.filter (< 10)
2021-03-24 16:04:56 <yahb> tomsmeding: ; <interactive>:66:19: error:; Not in scope: type constructor or class `Map'; Perhaps you meant `M.Map' (imported from Data.Map)
2021-03-24 16:05:03 <tomsmeding> % instance IJthing (M.Map Int Int) where onlySmallOnes = M.filter (< 10)
2021-03-24 16:05:03 <yahb> tomsmeding:
2021-03-24 16:05:12 × Sorny quits (~Sornaensi@077213203030.dynamic.telenor.dk) (Ping timeout: 260 seconds)
2021-03-24 16:05:16 <tomsmeding> % instance IJthing (M.Map Int (Set a)) where onlySmallOnes = M.filter ((< 10) . Set.size)
2021-03-24 16:05:16 <yahb> tomsmeding: ; <interactive>:68:30: error:; Not in scope: type constructor or class `Set'; Perhaps you meant one of these: `S.Set' (imported from Data.Set), `Seq.Seq' (imported from Data.Sequence); <interactive>:68:79: error:; Not in scope: `Set.size'; Perhaps you meant `S.size' (imported from Data.Set); No module named `Set' is imported.
2021-03-24 16:05:20 <tomsmeding> % instance IJthing (M.Map Int (Set a)) where onlySmallOnes = M.filter ((< 10) . S.size)
2021-03-24 16:05:20 <yahb> tomsmeding: ; <interactive>:69:30: error:; Not in scope: type constructor or class `Set'; Perhaps you meant one of these: `S.Set' (imported from Data.Set), `Seq.Seq' (imported from Data.Sequence)
2021-03-24 16:05:24 <tomsmeding> % instance IJthing (M.Map Int (S.Set a)) where onlySmallOnes = M.filter ((< 10) . S.size)
2021-03-24 16:05:24 <yahb> tomsmeding:
2021-03-24 16:05:40 <tomsmeding> % onlySmallOnes (M.fromList [(1,1), (2,10), (3,5)])
2021-03-24 16:05:40 <yahb> tomsmeding: ; <interactive>:71:1: error:; * No instance for (IJthing (M.Map Integer Integer)) arising from a use of `it'; * In the first argument of `print', namely `it'; In a stmt of an interactive GHCi command: print it
2021-03-24 16:05:50 <tomsmeding> % onlySmallOnes (M.fromList [(1,1), (2,10), (3,5)] :: M.Map Int Int)
2021-03-24 16:05:50 <yahb> tomsmeding: fromList [(1,1),(3,5)]
2021-03-24 16:06:16 <tomsmeding> % onlySmallOnes (M.fromList [(1,S.fromList [1]), (2,S.fromList [1..10]), (3,S.fromList [1..5])] :: M.Map Int (Set Int))
2021-03-24 16:06:16 <yahb> tomsmeding: ; <interactive>:73:109: error:; Not in scope: type constructor or class `Set'; Perhaps you meant one of these: `S.Set' (imported from Data.Set), `Seq.Seq' (imported from Data.Sequence)
2021-03-24 16:06:21 <tomsmeding> % onlySmallOnes (M.fromList [(1,S.fromList [1]), (2,S.fromList [1..10]), (3,S.fromList [1..5])] :: M.Map Int (S.Set Int))
2021-03-24 16:06:21 <yahb> tomsmeding: fromList [(1,fromList [1]),(3,fromList [1,2,3,4,5])]
2021-03-24 16:06:30 fendor_ joins (~fendor@91.141.1.9.wireless.dyn.drei.com)
2021-03-24 16:06:31 <tomsmeding> ij: okay so ignoring all the errors, something like this :)
2021-03-24 16:06:58 <tomsmeding> where onlySmallOnes is one of the things you want to work for both types
2021-03-24 16:07:25 × Kaeipi quits (~Kaiepi@47.54.252.148) (Remote host closed the connection)
2021-03-24 16:07:39 <tomsmeding> it would be nice if most of your functionality that you want to share over both types can be expressed in terms of a few, smallish base functions that you can put in the typeclass
2021-03-24 16:07:41 <ski> perhaps MPTC (with FD) or associated types could be an alternative
2021-03-24 16:07:57 Kaeipi joins (~Kaiepi@47.54.252.148)
2021-03-24 16:08:11 tomsmeding is somewhat confused
2021-03-24 16:08:25 <tomsmeding> what associated type are you thinking about?
2021-03-24 16:08:48 × fendor quits (~fendor@91.141.1.53.wireless.dyn.drei.com) (Ping timeout: 245 seconds)
2021-03-24 16:08:58 <ski> associating `Int' with `Map Int Int' and `Set a' with `Map Int (Set a)'
2021-03-24 16:09:00 average joins (uid473595@gateway/web/irccloud.com/x-mlwtnyrsvtyoarjl)
2021-03-24 16:09:12 × Kaeipi quits (~Kaiepi@47.54.252.148) (Remote host closed the connection)
2021-03-24 16:09:25 <ski> (iow, not having a single type that have both maps as alternatives)

All times are in UTC.