mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-30 11:51:57 +00:00
refactor for boolean blindness
This commit is contained in:
@@ -55,3 +55,8 @@ handleS9ErrNuclear :: MonadIO m => S9ErrT m a -> m a
|
||||
handleS9ErrNuclear action = runExceptT action >>= \case
|
||||
Left e -> throwIO e
|
||||
Right a -> pure a
|
||||
|
||||
errOnNothing :: MonadHandler m => Status -> Text -> Maybe a -> m a
|
||||
errOnNothing status res entity = case entity of
|
||||
Nothing -> sendResponseStatus status res
|
||||
Just a -> pure a
|
||||
@@ -16,6 +16,7 @@ import Yesod.Core
|
||||
|
||||
import Lib.Semver
|
||||
import Lib.Types.Semver
|
||||
import Data.Char
|
||||
|
||||
type Registry = HashMap String (HashMap AppVersion FilePath)
|
||||
|
||||
@@ -50,6 +51,11 @@ type S9PK = Extension "s9pk"
|
||||
type SYS_EXTENSIONLESS = Extension ""
|
||||
type PNG = Extension "png"
|
||||
|
||||
data Extensions = S9PK | PNG | EMPTY
|
||||
deriving (Read)
|
||||
instance Show Extensions where
|
||||
show a = fmap toLower $ show a
|
||||
|
||||
instance IsString (Extension a) where
|
||||
fromString = Extension
|
||||
|
||||
|
||||
6
src/Lib/Types/FileSystem.hs
Normal file
6
src/Lib/Types/FileSystem.hs
Normal file
@@ -0,0 +1,6 @@
|
||||
module Lib.Types.FileSystem where
|
||||
|
||||
import Startlude
|
||||
|
||||
data FileExistence = Existent | NonExistent
|
||||
deriving (Eq, Show)
|
||||
Reference in New Issue
Block a user