File: Internal.hs

package info (click to toggle)
haskell-debian 3.64-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 364 kB
  • sloc: haskell: 3,226; ansic: 8; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE DeriveDataTypeable #-}
module Debian.Version.Internal
    ( DebianVersion(..)
    , Numeric(..)
    , NonNumeric(..)
    , Found(..)
    )
    where

import Data.Data (Data)
import Data.Typeable (Typeable)

-- Currently we store the original version string in the data-type so
-- that we can faithfully reproduce it quickly. Currently we do not
-- have any way to modify a version number -- so this works fine. May
-- have to change later.
data DebianVersion
    = DebianVersion String (Found Int, NonNumeric, Found NonNumeric) deriving (Data, Typeable)

data NonNumeric
    = NonNumeric String (Found Numeric)
      deriving (Show, Data, Typeable)

data Numeric
    = Numeric Int (Maybe NonNumeric)
      deriving (Show, Data, Typeable)


data Found a
    = Found { unFound :: a }
    | Simulated { unFound :: a }
      deriving (Show, Data, Typeable)

instance (Eq a) => Eq (Found a) where
    f1 == f2 = (unFound f1) == (unFound f2)

instance (Ord a) => Ord (Found a) where
    compare f1 f2 = compare (unFound f1) (unFound f2)