mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-17 05:15:49 +01:00
Added StackageBranch
This commit is contained in:
parent
1e5614ca59
commit
be32c1a177
13
Types.hs
13
Types.hs
@ -20,6 +20,19 @@ instance PathPiece LtsMajor where
|
|||||||
Right (x, "") <- Just $ Reader.decimal t1
|
Right (x, "") <- Just $ Reader.decimal t1
|
||||||
Just $ LtsMajor x
|
Just $ LtsMajor x
|
||||||
|
|
||||||
|
data StackageBranch = LtsMajorBranch Int
|
||||||
|
| LtsBranch
|
||||||
|
| NightlyBranch
|
||||||
|
deriving (Eq, Read, Show)
|
||||||
|
instance PathPiece StackageBranch where
|
||||||
|
toPathPiece NightlyBranch = "nightly"
|
||||||
|
toPathPiece LtsBranch = "lts"
|
||||||
|
toPathPiece (LtsMajorBranch x) = toPathPiece $ LtsMajor x
|
||||||
|
|
||||||
|
fromPathPiece "nightly" = Just NightlyBranch
|
||||||
|
fromPathPiece "lts" = Just LtsBranch
|
||||||
|
fromPathPiece x = (\(LtsMajor x') -> LtsMajorBranch x') <$> fromPathPiece x
|
||||||
|
|
||||||
newtype PackageName = PackageName { unPackageName :: Text }
|
newtype PackageName = PackageName { unPackageName :: Text }
|
||||||
deriving (Show, Read, Typeable, Eq, Ord, Hashable, PathPiece, ToMarkup, PersistField, IsString)
|
deriving (Show, Read, Typeable, Eq, Ord, Hashable, PathPiece, ToMarkup, PersistField, IsString)
|
||||||
instance PersistFieldSql PackageName where
|
instance PersistFieldSql PackageName where
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user