packages feed

json-autotype 1.0.13 → 1.0.14

raw patch · 3 files changed

+11/−92 lines, 3 filesdep −hintdep ~lensPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: hint

Dependency ranges changed: lens

API changes (from Hackage documentation)

- Data.Aeson.AutoType.Plugin.Loader: importPlugins :: Typeable a => String -> [FilePath] -> IO [a]
- Data.Aeson.AutoType.Plugin.Loader: main :: IO ()
- Data.Aeson.AutoType.Plugin.Subtype: SubtypeDesc :: String -> Type -> (String -> String) -> String -> Dynamic -> SubtypeDesc
- Data.Aeson.AutoType.Plugin.Subtype: SubtypePlugin :: ([Value] -> Maybe SubtypeDesc) -> (SubtypeDesc -> SubtypeDesc -> Either SubtypeDesc Type) -> SubtypePlugin
- Data.Aeson.AutoType.Plugin.Subtype: [declare] :: SubtypeDesc -> String
- Data.Aeson.AutoType.Plugin.Subtype: [detect] :: SubtypePlugin -> [Value] -> Maybe SubtypeDesc
- Data.Aeson.AutoType.Plugin.Subtype: [reference] :: SubtypeDesc -> String -> String
- Data.Aeson.AutoType.Plugin.Subtype: [subtypeClass] :: SubtypeDesc -> Type
- Data.Aeson.AutoType.Plugin.Subtype: [subtypeName] :: SubtypeDesc -> String
- Data.Aeson.AutoType.Plugin.Subtype: [typeInfo] :: SubtypeDesc -> Dynamic
- Data.Aeson.AutoType.Plugin.Subtype: [unify] :: SubtypePlugin -> SubtypeDesc -> SubtypeDesc -> Either SubtypeDesc Type
- Data.Aeson.AutoType.Plugin.Subtype: data SubtypeDesc
- Data.Aeson.AutoType.Plugin.Subtype: data SubtypePlugin

Files

− Data/Aeson/AutoType/Plugin/Loader.hs
@@ -1,54 +0,0 @@-{-# LANGUAGE ScopedTypeVariables #-}--- | Module implementing loading generic plugins using Hint.-module Data.Aeson.AutoType.Plugin.Loader (-    importPlugins-  , main-  ) where--import           System.IO     ( hPutStrLn, stderr )-import           System.Exit   ( exitFailure )-import           Data.Typeable-import           Control.Arrow ((&&&))-import           Control.Monad-import qualified Language.Haskell.Interpreter as Hint---- | Test script-main :: IO ()-main  = do result :: [[Int]] <- importPlugins "export" moduleNames-           forM_ (zip moduleNames result) $ \(moduleName, exportVal) ->-             putStrLn $ concat [moduleName, ": ", show exportVal, "\n"]-  where-    moduleNames = ["Plugin.hs"-                  ,"Plugin2.hs"]---- | Fatal exit from the program-fatal :: String -> IO a-fatal msg = do-  hPutStrLn stderr msg-  exitFailure---- | Imports a set of plugin modules with the same "interface" value,--- and returns values exported as their interfaces.------ Arguments:---  * argument name exported from each module as an interface,---  * list of plugin modules (given as either module paths or file paths).------ Result:---  * Result is a list of exported objects in the order of module names.-importPlugins ::   Typeable a =>-                    String    ->-                   [FilePath] ->-                    IO [a]-importPlugins interfaceName pluginModules = do-    result <- Hint.runInterpreter $ do-      Hint.loadModules pluginModules-      moduleNames <- Hint.getLoadedModules-      Hint.setImportsQ $ ("Prelude", Nothing):map (id &&& Just) moduleNames-      mapM getInterfaceVar moduleNames-    case result of-      Left  err   -> fatal $ "Cannot load plugins:\n" ++ show err-      Right value -> return value-  where-    getInterfaceVar moduleName = Hint.interpret (moduleName ++ "." ++ interfaceName) Hint.as-
− Data/Aeson/AutoType/Plugin/Subtype.hs
@@ -1,27 +0,0 @@--- | API to which @SubtypePlugin@s should conform.-module Data.Aeson.AutoType.Plugin.Subtype (-    SubtypePlugin (..)-  , SubtypeDesc   (..)-  ) where--import Data.Aeson.AutoType.Type-import Data.Aeson-import Data.Dynamic---- | Hmm... this should be existential type?-type TypeDesc = String---- | Operations that @SubtypPlugin@ must implement.-data SubtypePlugin = SubtypePlugin {-    detect :: [Value]     -> Maybe SubtypeDesc -- | Check whether a set of values belongs to this type family-  , unify  :: SubtypeDesc -> SubtypeDesc -> Either SubtypeDesc Type-  }---- | Description of a subtype-data SubtypeDesc = SubtypeDesc {-    subtypeName  :: String           -- | Code that is different for different type families-  , subtypeClass :: Type-  , reference    :: String -> String -- | Show type reference with a given name prefix-  , declare      :: String           -- | Show type declaration-  , typeInfo     :: Dynamic-  }
json-autotype.cabal view
@@ -1,6 +1,6 @@ -- Build information for the package. name:                json-autotype-version:             1.0.13+version:             1.0.14 synopsis:            Automatic type declaration for JSON input data description:         Generates datatype declarations with Aeson's "FromJSON" instances                      from a set of example ".json" files.@@ -47,8 +47,8 @@                        Data.Aeson.AutoType.Pretty                        Data.Aeson.AutoType.CodeGen                        Data.Aeson.AutoType.Alternative-                       Data.Aeson.AutoType.Plugin.Subtype-                       Data.Aeson.AutoType.Plugin.Loader+                       -- Data.Aeson.AutoType.Plugin.Subtype+                       -- Data.Aeson.AutoType.Plugin.Loader   other-extensions:    TemplateHaskell,                        ScopedTypeVariables,                        OverloadedStrings,@@ -67,9 +67,9 @@                        containers           >=0.3  && <0.6,                        filepath             >=1.3  && <1.5,                        hashable             >=1.2  && <1.3,-                       hint                 >=0.4  && <0.6,+                       ---hint                 >=0.4  && <0.6,                        hflags               >=0.3  && <0.5,-                       lens                 >=4.1  && <4.14,+                       lens                 >=4.1  && <4.15,                        mmap                 >=0.5  && <0.6,                        mtl                  >=2.1  && <2.3,                        pretty               >=1.1  && <1.3,@@ -89,8 +89,8 @@                        Data.Aeson.AutoType.Pretty                        Data.Aeson.AutoType.CodeGen                        Data.Aeson.AutoType.Alternative-                       Data.Aeson.AutoType.Plugin.Subtype-                       Data.Aeson.AutoType.Plugin.Loader+                       -- Data.Aeson.AutoType.Plugin.Subtype+                       -- Data.Aeson.AutoType.Plugin.Loader                        Data.Aeson.AutoType.Util   other-extensions:    TemplateHaskell,                        ScopedTypeVariables,@@ -107,9 +107,9 @@                        containers           >=0.3  && <0.6,                        filepath             >=1.3  && <1.5,                        hashable             >=1.2  && <1.3,-                       hint                 >=0.4  && <0.6,+                       --hint                 >=0.4  && <0.6,                        hflags               >=0.3  && <0.5,-                       lens                 >=4.1  && <4.14,+                       lens                 >=4.1  && <4.15,                        mtl                  >=2.1  && <2.3,                        pretty               >=1.1  && <1.3,                        process              >=1.1  && <1.5,@@ -148,7 +148,7 @@                        directory            >=1.1  && <1.3,                        filepath             >=1.3  && <1.5,                        hashable             >=1.2  && <1.3,-                       lens                 >=4.1  && <4.14,+                       lens                 >=4.1  && <4.15,                        mtl                  >=2.1  && <2.3,                        pretty               >=1.1  && <1.3,                        process              >=1.1  && <1.5,@@ -190,7 +190,7 @@                        filepath             >=1.3  && <1.5,                        hashable             >=1.2  && <1.3,                        hflags               >=0.3  && <0.5,-                       lens                 >=4.1  && <4.14,+                       lens                 >=4.1  && <4.15,                        mtl                  >=2.1  && <2.3,                        pretty               >=1.1  && <1.3,                        process              >=1.1  && <1.5,