Skip to content

Instantly share code, notes, and snippets.

@cblp
Last active June 17, 2022 08:17
Show Gist options
  • Save cblp/3c806584e5303369e4d904a0c7bf2d03 to your computer and use it in GitHub Desktop.
Save cblp/3c806584e5303369e4d904a0c7bf2d03 to your computer and use it in GitHub Desktop.
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE RebindableSyntax #-}
import Data.Set (Set, singleton)
import GHC.Exts
import Prelude
xs :: Set Int
xs = [3, 15]
ys :: Set Int
ys = [9, 20]
zs :: Set Int
zs = [x + y | x <- xs, y <- ys]
where
return = singleton
s >>= f = foldMap f s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment