Could someone provide a link to a good coding standard for Haskell? I\'ve found this and this, but they are far from comprehensive. Not to mention that the HaskellWiki one inclu
Some good rules of thumbs imho:
Maybe (Maybe a) -> Maybe a
, then join
does that among other things.replicate :: Int -> a -> [a]
, it's pretty obvious what each of the arguments does, from their types alone.isPrefixOf :: (Eq a) => [a] -> [a] -> Bool
, naming/documentation of arguments is more important.where
clause instead of in the module's scope.zip3
, zipWith3
, zip4
, zipWith4
, etc are very meh. Use Applicative
style with ZipList
s instead. You probably never really need functions like those.Functor
(there is only one correct way to make a type an instance of Functor
).concat :: [[a]] -> [a]
, and notice how it can be more general as join :: Monad m => m (m a) -> m a
. There is less room for error when programming join
because when programming concat
you can reverse the lists by mistake and in join
there are very few things you can do.readFile
doesn't really read the file's contents at the moment the file is read.Applicative
behaved like ZipList
.