module Page ( Page(..) , at ) where import Markdown (Markdown(..), MarkdownContent(..)) import qualified Markdown as Markdown (at) import Text.ParserCombinators.Parsec (ParseError) newtype Page = Page Markdown instance MarkdownContent Page where getMarkdown :: Page -> Markdown getMarkdown (Page Markdown markdown) = Markdown markdown at :: FilePath -> IO (Either ParseError (String, Page)) at :: FilePath -> IO (Either ParseError (FilePath, Page)) at FilePath filePath = (Markdown -> (FilePath, Page)) -> Either ParseError Markdown -> Either ParseError (FilePath, Page) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Markdown -> (FilePath, Page) makePage (Either ParseError Markdown -> Either ParseError (FilePath, Page)) -> IO (Either ParseError Markdown) -> IO (Either ParseError (FilePath, Page)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> FilePath -> IO (Either ParseError Markdown) Markdown.at FilePath filePath where makePage :: Markdown -> (FilePath, Page) makePage Markdown markdown = (Markdown -> FilePath key Markdown markdown, Markdown -> Page Page Markdown markdown)