Skip to content

Instantly share code, notes, and snippets.

@hatashiro
Last active October 11, 2016 16:24
Show Gist options
  • Select an option

  • Save hatashiro/10a0d46f3d843fde547636266d8e80e4 to your computer and use it in GitHub Desktop.

Select an option

Save hatashiro/10a0d46f3d843fde547636266d8e80e4 to your computer and use it in GitHub Desktop.
Today's Haskell Poet
timestampPath :: IO FilePath
timestampPath = ???
-- using do, more readable.
writeTimestamp :: UnixTime -> IO ()
writeTimestamp x = do
path <- timestampPath
writeFile path (encodeUnixTime x)
-- using point-free style, feeling good.
writeTimestamp :: UnixTime -> IO ()
writeTimestamp = (timestampPath >>=) . flip writeFile . encodeUnixTime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment