futhark-manifest 1.8.0.0 → 1.9.0.0
raw patch · 4 files changed
+34/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Futhark.Manifest: [entryPointDoc] :: EntryPoint -> Doc
+ Futhark.Manifest: type Doc = Maybe Text
- Futhark.Manifest: EntryPoint :: CFuncName -> [Text] -> Output -> [Input] -> [Text] -> EntryPoint
+ Futhark.Manifest: EntryPoint :: CFuncName -> [Text] -> Output -> [Input] -> [Text] -> Doc -> EntryPoint
- Futhark.Manifest: TypeOpaque :: CTypeName -> OpaqueOps -> Maybe OpaqueExtraOps -> Type
+ Futhark.Manifest: TypeOpaque :: CTypeName -> OpaqueOps -> Maybe OpaqueExtraOps -> Doc -> Type
Files
- CHANGELOG.md +9/−1
- futhark-manifest.cabal +1/−1
- src/Futhark/Manifest.hs +15/−6
- tests/Tests.hs +9/−2
CHANGELOG.md view
@@ -1,8 +1,16 @@ # Revision history for futhark-manifest +## 1.9.0.0++* New type `Doc` for representing documentation comments.++* `EntryPoint` has a new field: `entryPointDoc` of type `Doc`.++* `TypeOpaque` has a new payload of type `Doc`.+ ## 1.8.0.0 -Replaced `entryPointOutputs` with `entryPointOutput`.+* Replaced `entryPointOutputs` with `entryPointOutput`. ## 1.7.0.0
futhark-manifest.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: futhark-manifest-version: 1.8.0.0+version: 1.9.0.0 synopsis: Definition and serialisation instances for Futhark manifests.
src/Futhark/Manifest.hs view
@@ -21,6 +21,7 @@ CFuncName, CTypeName, TypeName,+ Doc, -- * Manifest Manifest (..),@@ -67,6 +68,9 @@ -- corresponding entry in 'manifestTypes'. type TypeName = T.Text +-- | A optional documentation string, taken from the original Futhark program.a+type Doc = Maybe T.Text+ -- | Manifest info for an entry point parameter. data Input = Input { inputName :: T.Text,@@ -88,7 +92,8 @@ entryPointTuningParams :: [T.Text], entryPointOutput :: Output, entryPointInputs :: [Input],- entryPointAttrs :: [T.Text]+ entryPointAttrs :: [T.Text],+ entryPointDoc :: Doc } deriving (Eq, Ord, Show) @@ -210,11 +215,11 @@ -- | Manifest info for a non-scalar type. Scalar types are not part of -- the manifest for a program. Although this representation allows a -- type to be both a a record and a sum type, this will never actually--- happen.+-- happen. An opaque type is associated with a documentation comment. data Type = -- | ctype, Futhark elemtype, rank. TypeArray CTypeName TypeName Int ArrayOps- | TypeOpaque CTypeName OpaqueOps (Maybe OpaqueExtraOps)+ | TypeOpaque CTypeName OpaqueOps (Maybe OpaqueExtraOps) Doc deriving (Eq, Ord, Show) -- | A manifest for a compiled program.@@ -323,14 +328,15 @@ ) ] where- onEntryPoint (EntryPoint cfun tuning_params output inputs attrs) =- object+ onEntryPoint (EntryPoint cfun tuning_params output inputs attrs doc) =+ object $ [ ("cfun", toJSON cfun), ("tuning_params", toJSON tuning_params), ("output", toJSON $ onOutput output), ("inputs", toJSON $ map onInput inputs), ("attributes", toJSON attrs) ]+ ++ [("doc", toJSON doc') | Just doc' <- [doc]] onOutput (Output t u) = object@@ -353,12 +359,13 @@ ("elemtype", toJSON et), ("ops", toJSON ops) ]- onType (TypeOpaque t ops extra_ops) =+ onType (TypeOpaque t ops extra_ops doc) = object $ [ ("kind", "opaque"), ("ctype", toJSON t), ("ops", toJSON ops) ]+ ++ [("doc", toJSON doc') | Just doc' <- [doc]] ++ case extra_ops of Nothing -> [] Just (OpaqueRecord recordops) ->@@ -438,6 +445,7 @@ <*> v .: "output" <*> v .: "inputs" <*> v .: "attributes"+ <*> v .:? "doc" instance JSON.FromJSON Output where parseJSON = JSON.withObject "Output" $ \v ->@@ -468,6 +476,7 @@ <*> ty .:? "opaque_array" <*> ty .:? "record_array" )+ <*> ty .:? "doc" where f (Just x) _ _ _ = Just (OpaqueRecord x) f _ (Just x) _ _ = Just (OpaqueSum x)
tests/Tests.hs view
@@ -73,7 +73,7 @@ arbitrary = oneof [ TypeArray <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary,- TypeOpaque <$> arbitrary <*> arbitrary <*> arbitrary+ TypeOpaque <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary ] instance Arbitrary Output where@@ -83,7 +83,14 @@ arbitrary = Input <$> arbitrary <*> arbitrary <*> arbitrary instance Arbitrary EntryPoint where- arbitrary = EntryPoint <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary+ arbitrary =+ EntryPoint+ <$> arbitrary+ <*> arbitrary+ <*> arbitrary+ <*> arbitrary+ <*> arbitrary+ <*> arbitrary instance Arbitrary Manifest where arbitrary = Manifest <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary