2024/12/21

Newest at the top

2024-12-21 19:53:18 +0100 <EvanR> even better
2024-12-21 19:52:55 +0100 <iqubic> My map only has at most 10 key value pairs and all the values are distinct.
2024-12-21 19:52:34 +0100 <EvanR> probie showed a possible incantation to use it
2024-12-21 19:52:19 +0100 <iqubic> A bidirectional map would be overkill.
2024-12-21 19:52:17 +0100 <EvanR> yeah Data.Map has a filter function
2024-12-21 19:51:27 +0100 <geekosaur> there are bedirectional maps, but I don't know if that fits your need
2024-12-21 19:51:14 +0100 <lambdabot> Data.Map.Utils flipM :: (Ord key, Ord val) => Map key val -> Map val [key]
2024-12-21 19:51:13 +0100 <ski> @hoogle Map k v -> Map v [k]
2024-12-21 19:50:49 +0100 <iqubic> I was just wondering if there was a helper function that did this for me, but I guess not. What I have is clean enough for my purposes.
2024-12-21 19:49:56 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 264 seconds)
2024-12-21 19:49:51 +0100 <ski> iqubic : i think you need to iterate through all associations in the map (because they're indexed by key, not by value). if you could do with `Ord v', there might be some bimap data structure, or a `(Ord k,Ord v) => Map k v -> Map v [k]' (or `NonEmpty' instead of `[]', perhaps)
2024-12-21 19:49:28 +0100 <lambdabot> Eq a => M.Map k a -> a -> [k]
2024-12-21 19:49:26 +0100 <probie> :t \m x -> M.keys $ M.filter (== x) $ m
2024-12-21 19:45:04 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2024-12-21 19:45:03 +0100rachelambda8(~rachelamb@cust-95-80-25-71.csbnet.se)
2024-12-21 19:43:44 +0100rachelambda8(~rachelamb@cust-95-80-25-71.csbnet.se) (Quit: β reduced)
2024-12-21 19:43:14 +0100Smiles(uid551636@id-551636.lymington.irccloud.com) (Quit: Connection closed for inactivity)
2024-12-21 19:41:05 +0100sprotte24(~sprotte24@p200300d16f1a2c0064c6ee858fd5dcfe.dip0.t-ipconnect.de)
2024-12-21 19:37:46 +0100 <iqubic> "matchingKeys map x = [value | (key, value) <- M.toList map, value == x]"
2024-12-21 19:37:43 +0100 <iqubic> Is there a better way to write this function: "matchingKeys :: (Eq v) => Map k v -> v -> [k]"
2024-12-21 19:37:27 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
2024-12-21 19:32:54 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2024-12-21 19:28:13 +0100Square(~Square@user/square) Square
2024-12-21 19:27:58 +0100Square(~Square@user/square) (Client Quit)
2024-12-21 19:26:31 +0100Square(~Square@user/square) Square
2024-12-21 19:22:38 +0100Lord_of_Life_Lord_of_Life
2024-12-21 19:22:05 +0100 <haskellbridge> <thirdofmay18081814goya> what's the right data structure to capture both "A" and "f(e)"
2024-12-21 19:22:00 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 260 seconds)
2024-12-21 19:21:51 +0100 <haskellbridge> <thirdofmay18081814goya> "A :: Page" contains a list of elements "[ElemType]" such that "e :: ElemType" determines a new page "f(e) :: Page"
2024-12-21 19:21:24 +0100rachelambda8(~rachelamb@cust-95-80-25-71.csbnet.se)
2024-12-21 19:20:54 +0100weary-traveler(~user@user/user363627) (Remote host closed the connection)
2024-12-21 19:19:41 +0100Lord_of_Life_(~Lord@user/lord-of-life/x-2819915) Lord_of_Life
2024-12-21 19:19:29 +0100Lord_of_Life(~Lord@user/lord-of-life/x-2819915) (Ping timeout: 248 seconds)
2024-12-21 19:17:28 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2024-12-21 19:09:47 +0100Guest78(~Guest78@37.228.252.73)
2024-12-21 19:06:57 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 276 seconds)
2024-12-21 19:06:18 +0100ljdarj(~Thunderbi@user/ljdarj) (Ping timeout: 244 seconds)
2024-12-21 19:02:07 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) merijn
2024-12-21 19:01:45 +0100alecs(~alecs@61.pool85-58-154.dynamic.orange.es) (Ping timeout: 276 seconds)
2024-12-21 18:56:42 +0100alecs(~alecs@61.pool85-58-154.dynamic.orange.es) alecs
2024-12-21 18:51:49 +0100 <WzC> interesting idea; doesn't seem to though :(
2024-12-21 18:50:54 +0100merijn(~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
2024-12-21 18:50:30 +0100skiwonders whether that might help
2024-12-21 18:50:20 +0100lxsameer(~lxsameer@Serene/lxsameer) lxsameer
2024-12-21 18:49:58 +0100 <ski> hm, can you do `data Foo k (s :: k) = Foo' ?
2024-12-21 18:47:40 +0100 <WzC> i.e. the haddocks now say: class a ~R# b => Coercible (a :: k) (b :: k)
2024-12-21 18:47:16 +0100 <WzC> I think the issue is that the coercible typeclass seems to actually have kind annotations that force that the types have to have the same kind
2024-12-21 18:47:09 +0100michalz(~michalz@185.246.207.203)
2024-12-21 18:46:45 +0100 <WzC> unfortunately not
2024-12-21 18:45:58 +0100 <ski> type role Foo phantom -- does adding this help ? (need `RoleAnnotations')