]> Git — Sourcephile - doclang.git/blob - Language/DTC/Utils.hs
Add style/dtc-html5.css
[doclang.git] / Language / DTC / Utils.hs
1 module Language.DTC.Utils where
2
3 import Control.Applicative (Applicative(..))
4 import Data.Eq (Eq)
5 import Data.Function (($), (.))
6 import Data.Functor (Functor(..), (<$>))
7 import Text.Show (Show)
8
9 -- * Type 'PaddedList'
10 data PaddedList a
11 = PaddedList { padded :: [a]
12 , padder :: a
13 } deriving (Eq, Show)
14
15 instance Functor PaddedList where
16 fmap = (<*>) . pure
17 instance Applicative PaddedList where
18 pure = PaddedList []
19 PaddedList xs x <*> PaddedList ys y =
20 zapp xs ys `PaddedList` x y
21 where
22 zapp [] bs = x <$> bs
23 zapp as [] = ($ y) <$> as
24 zapp (a : as) (b : bs) = a b : zapp as bs
25