diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-02 02:07:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-02 02:07:15 -0400 |
commit | 93f29997a90474b740f624729029acf184906b35 (patch) | |
tree | ee89a0124abe1cd8438198da8f8d99939444cd6f | |
parent | 837cd79e4f2e00a1a970a48e843e28d35d8cf809 (diff) |
reduce some boilerplate using ghc extensions
-rw-r--r-- | Assistant/WebApp/Types.hs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/Assistant/WebApp/Types.hs b/Assistant/WebApp/Types.hs index 988f909d7..26b73af9d 100644 --- a/Assistant/WebApp/Types.hs +++ b/Assistant/WebApp/Types.hs @@ -5,7 +5,9 @@ - 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 #-} module Assistant.WebApp.Types where @@ -77,19 +79,7 @@ data SshData = SshData } deriving (Read, Show, Eq) -instance PathPiece SshData where - toPathPiece = pack . show - 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 +{- Allow any serializable data type to be used as a PathPiece -} +instance (Show a, Read a) => PathPiece a where toPathPiece = pack . show fromPathPiece = readish . unpack |