[darcs-users] ratification (haskell_policy / hlint)

Neil Mitchell ndmitchell at gmail.com
Sun Sep 19 07:57:34 UTC 2010


Hi Eric,

>  {-# ANN map "HLint: ignore" #-} - don't give any hints in the function map.
>
> map is an example of a function we would write?

Yes, but I can see how that example is confusing. I've changed it to
myFunction instead of map in the manual.

> As an example of ratification at work, we have
>
> getLog :: forall x y . [DarcsFlag] -> Maybe (String, [String]) -> IO String -> FL Prim x y ->
>           IO (String, [String], Maybe String)
> getLog opts m_old make_log chs = gl opts
>    where -- some lines of code removed ...
>          gl (Pipe:_) = do p <- case patchname_specified of
>                                  FlagPatchName p  -> return p
>                                  PriorPatchName p -> return p
>                                  NoPatchName      -> prompt_patchname False
>                           putStrLn "What is the log?"
>                           thelog <- lines `fmap` Ratified.hGetContents stdin
>                           return (p, thelog, Nothing)
>         -- more lines of code removed
>
> And here instead we'd be using something like
>
>  {-# ANN getLog "HLint: ignore Avoid hGetContents" #-}
>
> If that's the case, we may just stick with the qualified Ratified module import
> for now, so that we can have very fine grained control [eg. we may have some
> uses of hGetContents in getLog that we would not want to ratify]

Yes, the use of a Ratified module is more fine grained, and actually
seems an excellent way to ratify functions - its safe, and it shows up
every time the function is used. I don't think there would be any way
to improve on this for your use case.

Thanks, Neil


More information about the darcs-users mailing list