hslua-typing 0.1.1 → 0.2.0
raw patch · 5 files changed
+19/−60 lines, 5 filesdep −textdep ~containersPVP ok
version bump matches the API change (PVP)
Dependencies removed: text
Dependency ranges changed: containers
API changes (from Hackage documentation)
- HsLua.Typing: TypeDocs :: Text -> TypeSpec -> Maybe Name -> TypeDocs
- HsLua.Typing: [typeDescription] :: TypeDocs -> Text
- HsLua.Typing: [typeRegistry] :: TypeDocs -> Maybe Name
- HsLua.Typing: [typeSpec] :: TypeDocs -> TypeSpec
- HsLua.Typing: data TypeDocs
- HsLua.Typing: instance GHC.Classes.Eq HsLua.Typing.TypeDocs
- HsLua.Typing: instance GHC.Classes.Ord HsLua.Typing.TypeDocs
- HsLua.Typing: instance GHC.Generics.Generic HsLua.Typing.TypeDocs
- HsLua.Typing: instance GHC.Show.Show HsLua.Typing.TypeDocs
- HsLua.Typing: peekTypeDoc :: LuaError e => Peeker e TypeDocs
- HsLua.Typing: pushTypeDoc :: LuaError e => Pusher e TypeDocs
Files
- CHANGELOG.md +7/−0
- LICENSE +1/−1
- hslua-typing.cabal +9/−16
- src/HsLua/Typing.hs +1/−32
- test/test-hslua-typing.hs +1/−11
CHANGELOG.md view
@@ -2,6 +2,13 @@ `hslua-typing` uses [PVP Versioning][]. +## hslua-typing-0.2.0++Released 2026-01-08.++- Drop type *TypeDocs* together with the peeker and pusher+ functions `peekTypeDoc` and `pushTypeDoc`.+ ## hslua-typing-0.1.1 Released 2024-01-18.
LICENSE view
@@ -1,4 +1,4 @@-Copyright © 2023-2024 Albert Krewinkel+Copyright © 2023-2026 Albert Krewinkel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hslua-typing.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hslua-typing-version: 0.1.1+version: 0.2.0 synopsis: Type specifiers for Lua. description: Structure to hold detailed type information. The primary use-case at this time are auto-generated docs.@@ -9,19 +9,14 @@ license-file: LICENSE author: Albert Krewinkel maintainer: Albert Krewinkel <tarleb@hslua.org>-copyright: © 2023-2024 Albert Krewinkel+copyright: © 2023-2026 Albert Krewinkel category: Foreign extra-source-files: README.md , CHANGELOG.md-tested-with: GHC == 8.4.4- , GHC == 8.6.5- , GHC == 8.8.4- , GHC == 8.10.7- , GHC == 9.0.2- , GHC == 9.2.8- , GHC == 9.4.8- , GHC == 9.6.3- , GHC == 9.8.1+tested-with: GHC == 9.6+ , GHC == 9.8+ , GHC == 9.10+ , GHC == 9.12 source-repository head type: git@@ -45,21 +40,19 @@ -Wpartial-fields -Wredundant-constraints -fhide-source-paths- if impl(ghc >= 8.10)- ghc-options: -Wunused-packages+ ghc-options: -Wunused-packages if impl(ghc >= 9.0)- ghc-options: -Winvalid-haddock+ ghc-options: -Winvalid-haddock library import: common-options exposed-modules: HsLua.Typing hs-source-dirs: src- build-depends: containers >= 0.5.9 && < 0.8+ build-depends: containers >= 0.5.9 && < 0.9 , hslua-core >= 2.3 && < 2.4 , hslua-marshalling >= 2.3 && < 2.4- , text >= 1.2 && < 2.2 default-language: Haskell2010 test-suite test-hslua-typing
src/HsLua/Typing.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module : HsLua.Typing-Copyright : © 2023-2024 Albert Krewinkel+Copyright : © 2023-2026 Albert Krewinkel License : MIT Maintainer : Albert Krewinkel <tarleb@hslua.org> @@ -12,7 +12,6 @@ -} module HsLua.Typing ( TypeSpec (..)- , TypeDocs (..) , (#|#) , typeSpecToString , typeSpecFromString@@ -36,15 +35,12 @@ -- * Marshalling , pushTypeSpec , peekTypeSpec- , pushTypeDoc- , peekTypeDoc ) where import Control.Monad (when) import Data.Char (toLower, toUpper) import Data.List (find, intercalate) import Data.String (IsString (..))-import Data.Text (Text) import GHC.Generics (Generic) import HsLua.Core import HsLua.Core.Utf8 (toString)@@ -65,14 +61,6 @@ | AnyType -- ^ Unconstrained type. deriving (Eq, Generic, Ord, Show) --- | Documented custom type.-data TypeDocs = TypeDocs- { typeDescription :: Text- , typeSpec :: TypeSpec- , typeRegistry :: Maybe Name- }- deriving (Eq, Generic, Ord, Show)- -- | Returns the sum of two type specifiers, declaring that a Lua value -- can have either type. (#|#) :: TypeSpec -> TypeSpec -> TypeSpec@@ -223,25 +211,6 @@ -- -- Marshalling ------ | Pushes documentation for a custom type.-pushTypeDoc :: LuaError e => Pusher e TypeDocs-pushTypeDoc td = do- checkstack' 8 "HsLua.Typing.pushTypeDoc"- pushAsTable- [ ("description", pushText . typeDescription)- , ("typespec", pushTypeSpec . typeSpec)- , ("registry", maybe pushnil pushName . typeRegistry)- ] td---- | Retrieves a custom type specifier.-peekTypeDoc :: LuaError e => Peeker e TypeDocs-peekTypeDoc = typeChecked "TypeDoc" istable $ \idx -> do- liftLua $ checkstack' 8 "HsLua.Typing.peekTypeDoc"- desc <- peekFieldRaw peekText "description" idx- spec <- peekFieldRaw peekTypeSpec "typespec" idx- regn <- peekFieldRaw (peekNilOr peekName) "registry" idx- return $ TypeDocs desc spec regn -- | Pushes a table representation of a 'TypeSpec' to the stack. pushTypeSpec :: LuaError e
test/test-hslua-typing.hs view
@@ -3,7 +3,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module : Main-Copyright : © 2023-2024 Albert Krewinkel+Copyright : © 2023-2026 Albert Krewinkel License : MIT Maintainer : Albert Krewinkel <tarleb@hslua.org> @@ -89,22 +89,12 @@ , testGroup "Marshalling" [ testProperty "Roundtrip TypeSpec" $ assertRoundtripEqual pushTypeSpec peekTypeSpec-- , testProperty "Roundtrip TypeDocs" $- assertRoundtripEqual pushTypeDoc peekTypeDoc ] ] instance Arbitrary TypeSpec where arbitrary = arbitraryTypeSpec 3 shrink = shrinkTypeSpec--instance Arbitrary TypeDocs where- arbitrary = TypeDocs- <$> arbitrary- <*> arbitrary- <*> arbitrary- shrink td = (\ts -> td{ typeSpec = ts}) <$> shrink (typeSpec td) instance Arbitrary Name where arbitrary = Name . fromString <$> arbitrary