I have the following:
import Data.List
data Content
= TaggedContent (String, [String]) String
| Null
processContent :: Content -> IO Content
processContent c@(TaggedContent (id, attrs) text) =
case stripPrefix "include=" a of
Just f -> return . TaggedContent (id, attrs) =<< readFile f
Nothing -> return c
where a = head(attrs)
processContent x = return x
transformContent :: Content -> Content
transformContent x = x -- (details of implementation not necessary)
I would like to compose transformContent
with the TaggedContent
constructor; that is, something like
Just f -> return . transformContent TaggedContent (id, attrs) =<< readFile f
However, this will not compile.
I am new to Haskell and am trying to understand the correct syntax.