Pandoc filter to allow embedding arbitary HTML in latex documents
I think it's clearer to just merge all those functions into one since you only really care about one case:

convertCode :: String -&gt; Maybe [Block]
convertCode code =
  case strip codeHead of
    ('%':'%':'%':' ':typeName) -&gt; matchType $ strip typeName
    _                          -&gt; Nothing
 where
   (codeHead, codeTail) = splitWhen (== '\n') $ strip code

   matchType "html" = Just [RawBlock (Format "html") codeTail]
   matchType _      = Nothing


Does this do the same thing? I cant test it without too much effort on my part.