Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created January 1, 2013 01:17
Show Gist options
  • Select an option

  • Save mxswd/4424505 to your computer and use it in GitHub Desktop.

Select an option

Save mxswd/4424505 to your computer and use it in GitHub Desktop.
Domain management at its simplest.
import Data.List
data Domain = Domain { domain :: String, dns :: DNS } deriving (Show)
data Service = Service { name :: String, servtype :: ServType, description :: String } deriving (Show)
data ServType = Heroku | GitHubPages | Redirect deriving (Show, Eq)
data DNS = DNS { dprovider :: String, dname :: String, services :: [Service] } deriving (Show)
-- presentation
listZoneOf q = nub $ map (dname . dns) $ filter (\x -> dprovider (dns x) == q) domains
listType t = map description $ filter (\x -> servtype x == t) $ foldl (\x y -> x ++ (services . dns) y) [] domains
domains = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment