
13 Aug
2020
13 Aug
'20
9:09 a.m.
From: Edward Kmett
fromIntegralMaybe :: (Integral a, Num b) => a -> Maybe b fromIntegralMaybe = fromIntegerMaybe . toInteger
I’m late to the party, so might be missing something. Did someone already proposed using http://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Bits.html#v:toInt..., which has a very similar signature? toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b No need for O(n^2) instances and it is already in `base`. Best regards, Andrew