import qualified Data.Set as Set
newtype AlwaysEq a = AlwaysEq { unAlwaysEq :: a }
instance Eq (AlwaysEq a) where
_ == _ = True
instance Ord (AlwaysEq a) where
_ `compare` _ = EQ
main :: IO ()
main = do
let s = Set.fromList [1..3]
print $ (Set.map unAlwaysEq . Set.map AlwaysEq) s
print $ Set.map (unAlwaysEq . AlwaysEq) s
Set is not a functor
As of March 2020, School of Haskell has been switched to read-only mode.
comments powered by Disqus