diff options
Diffstat (limited to 'src/Phi/Panel.hs')
-rw-r--r-- | src/Phi/Panel.hs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/Phi/Panel.hs b/src/Phi/Panel.hs deleted file mode 100644 index 23b022f..0000000 --- a/src/Phi/Panel.hs +++ /dev/null @@ -1,40 +0,0 @@ -{-# LANGUAGE ExistentialQuantification #-} - -module Phi.Panel ( Panel(..) - , PanelClass(..) - , (<~>) - , separator - ) where - -import Data.Function - -class PanelClass a where - minSize :: a -> Int - - weight :: a -> Float - weight _ = 0 - -data Panel = forall a. PanelClass a => Panel a - -instance PanelClass Panel where - minSize (Panel p) = minSize p - weight (Panel p) = weight p - -data CompoundPanel = CompoundPanel Panel Panel - -instance PanelClass CompoundPanel where - minSize (CompoundPanel a b) = ((+) `on` minSize) a b - weight (CompoundPanel a b) = ((+) `on` weight) a b - -(<~>) :: Panel -> Panel -> Panel -a <~> b = Panel $ CompoundPanel a b - - -data Separator = Separator Int Float - -instance PanelClass Separator where - minSize (Separator s _) = s - weight (Separator _ w) = w - -separator :: Int -> Float -> Panel -separator s w = Panel $ Separator s w |