{-# LANGUAGE NoMonomorphismRestriction, GeneralizedNewtypeDeriving #-}

module DerivationTrees.Basics 

 where

import GHC.Exts( IsString(..) )
import Data.Monoid


instance IsString TeX where
    fromString = TeX

data LineStyle = None | Simple | Double | Dotted | Dashed | Waved | TeXDotted 
  deriving (Enum,Show)

data Link = Link {label :: TeX, style :: LineStyle, align :: Alignment, steps :: Int}  -- ^ Regular link
          | Detached {ident :: Int, label :: TeX}                                      -- ^ Detach the derivation as another figure
          | Delayed {align :: Alignment} -- ^ automatic delaying
 deriving Show

defaultLink :: Link
defaultLink = Link mempty Dotted CenterA 0

data Alignment = LeftA | CenterA | RightA
instance Show Alignment where    
    show LeftA = "l"
    show CenterA = "c"
    show RightA = "r"

newtype TeX = TeX String
  deriving (Show, Monoid)

(<>) = mappend

void :: TeX -> Bool
void (TeX x) = null x