reduce some boilerplate using ghc extensions
This commit is contained in:
parent
837cd79e4f
commit
93f29997a9
1 changed files with 5 additions and 15 deletions
|
@ -5,7 +5,9 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings, RankNTypes #-}
|
{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}
|
||||||
|
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell, OverloadedStrings, RankNTypes #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Assistant.WebApp.Types where
|
module Assistant.WebApp.Types where
|
||||||
|
@ -77,19 +79,7 @@ data SshData = SshData
|
||||||
}
|
}
|
||||||
deriving (Read, Show, Eq)
|
deriving (Read, Show, Eq)
|
||||||
|
|
||||||
instance PathPiece SshData where
|
{- Allow any serializable data type to be used as a PathPiece -}
|
||||||
toPathPiece = pack . show
|
instance (Show a, Read a) => PathPiece a where
|
||||||
fromPathPiece = readish . unpack
|
|
||||||
|
|
||||||
|
|
||||||
instance PathPiece NotificationId where
|
|
||||||
toPathPiece = pack . show
|
|
||||||
fromPathPiece = readish . unpack
|
|
||||||
|
|
||||||
instance PathPiece AlertId where
|
|
||||||
toPathPiece = pack . show
|
|
||||||
fromPathPiece = readish . unpack
|
|
||||||
|
|
||||||
instance PathPiece Transfer where
|
|
||||||
toPathPiece = pack . show
|
toPathPiece = pack . show
|
||||||
fromPathPiece = readish . unpack
|
fromPathPiece = readish . unpack
|
||||||
|
|
Loading…
Reference in a new issue