mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-29 04:10:24 +01:00
Removed LtsMajor
This commit is contained in:
parent
5133a38006
commit
0fc5bbbf43
18
Types.hs
18
Types.hs
@ -11,15 +11,6 @@ import qualified Data.Text.Lazy.Builder as Builder
|
|||||||
import qualified Data.Text.Lazy as LText
|
import qualified Data.Text.Lazy as LText
|
||||||
import qualified Data.Text.Read as Reader
|
import qualified Data.Text.Read as Reader
|
||||||
|
|
||||||
newtype LtsMajor = LtsMajor Int
|
|
||||||
deriving (Eq, Read, Show)
|
|
||||||
instance PathPiece LtsMajor where
|
|
||||||
toPathPiece (LtsMajor x) = "lts-" ++ tshow x
|
|
||||||
fromPathPiece t0 = do
|
|
||||||
t1 <- stripPrefix "lts-" t0
|
|
||||||
Right (x, "") <- Just $ Reader.decimal t1
|
|
||||||
Just $ LtsMajor x
|
|
||||||
|
|
||||||
data StackageBranch = LtsMajorBranch Int
|
data StackageBranch = LtsMajorBranch Int
|
||||||
| LtsBranch
|
| LtsBranch
|
||||||
| NightlyBranch
|
| NightlyBranch
|
||||||
@ -27,11 +18,14 @@ data StackageBranch = LtsMajorBranch Int
|
|||||||
instance PathPiece StackageBranch where
|
instance PathPiece StackageBranch where
|
||||||
toPathPiece NightlyBranch = "nightly"
|
toPathPiece NightlyBranch = "nightly"
|
||||||
toPathPiece LtsBranch = "lts"
|
toPathPiece LtsBranch = "lts"
|
||||||
toPathPiece (LtsMajorBranch x) = toPathPiece $ LtsMajor x
|
toPathPiece (LtsMajorBranch x) = "lts-" ++ tshow x
|
||||||
|
|
||||||
fromPathPiece "nightly" = Just NightlyBranch
|
fromPathPiece "nightly" = Just NightlyBranch
|
||||||
fromPathPiece "lts" = Just LtsBranch
|
fromPathPiece "lts" = Just LtsBranch
|
||||||
fromPathPiece x = (\(LtsMajor x') -> LtsMajorBranch x') <$> fromPathPiece x
|
fromPathPiece t0 = do
|
||||||
|
t1 <- stripPrefix "lts-" t0
|
||||||
|
Right (x, "") <- Just $ Reader.decimal t1
|
||||||
|
Just $ LtsMajorBranch 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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user