kallisti-dev/hs-webdriver — pull request #61 by robertmassaioli (2014-11-09 07:36:41+00:00)
Title: (#60) Quick Fix: simplified some code.

Here is my logic for the refactor:

$ :t (:[])
(:[]) :: a -> [a]
$ :t return
return :: Monad m => a -> m a
$ :t return :: (a -> [a])
return :: (a -> [a]) :: a -> [a]
$ :m + Data.ByteString.Lazy.Char8
$ :t from
fromChunks fromEnum fromInteger fromIntegral fromRational fromStrict
$ :t fromChunks . (:[])
fromChunks . (:[])
:: Data.ByteString.Internal.ByteString -> ByteString
$ :t fromChunks . return
fromChunks . return
:: Data.ByteString.Internal.ByteString -> ByteString
$ :t fromStrict
fromStrict :: Data.ByteString.Internal.ByteString -> ByteString
$

As you can see (:[]) is just the list specific equivalent of the return function for monads. So you could write that line as fromChunks . return.

However, there is no need as fromStrict does exactly what you need and I believe that it has been part of the Data.ByteString package for quite some time. Cheers!