packages feed

lua-arbitrary (empty) → 1.0.0

raw patch · 5 files changed

+145/−0 lines, 5 filesdep +QuickCheckdep +basedep +lua

Dependencies added: QuickCheck, base, lua

Files

+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog++`lua-arbitrary` uses [PVP Versioning][1].++[1]: https://pvp.haskell.org++## lua-arbitrary 1.0.0++Release pending.++Extracted from hslua-1.3.0.
+ LICENSE view
@@ -0,0 +1,23 @@+Copyright © 1994-2020 Lua.org, PUC-Rio.+Copyright © 2007-2012 Gracjan Polak+Copyright © 2012-2015 Ömer Sinan Ağacan+Copyright © 2016-2021 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 in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ README.md view
@@ -0,0 +1,13 @@+# lua-arbitrary++[![Build status][GitHub Actions badge]][GitHub Actions]+[![AppVeyor Status]](https://ci.appveyor.com/project/tarleb/hslua-r2y18)+[![Hackage]](https://hackage.haskell.org/package/lua-arbitrary)++This package provides (orphaned) instances of QuickCheck's+"Arbitrary" typeclass.++[GitHub Actions badge]: https://img.shields.io/github/workflow/status/hslua/hslua/CI.svg?logo=github+[GitHub Actions]: https://github.com/hslua/hslua/actions+[AppVeyor Status]: https://ci.appveyor.com/api/projects/status/ldutrilgxhpcau94/branch/main?svg=true+[Hackage]: https://img.shields.io/hackage/v/lua-arbitrary.svg
+ lua-arbitrary.cabal view
@@ -0,0 +1,53 @@+cabal-version:       2.2+name:                lua-arbitrary+version:             1.0.0+synopsis:            Arbitrary instances for Lua types.+description:         Provides instances for QuickCheck's \"Arbitrary\"+                     typeclass.+homepage:            https://hslua.org/+bug-reports:         https://github.com/hslua/hslua/issues+license:             MIT+license-file:        LICENSE+author:              Albert Krewinkel, Gracjan Polak, Ömer Sinan Ağacan+maintainer:          albert+hslua@zeitkraut.de+copyright:           © 2007–2012 Gracjan Polak;+                     © 2012–2016 Ömer Sinan Ağacan;+                     © 2017-2021 Albert Krewinkel+category:            Foreign+build-type:          Simple+extra-source-files:  README.md+                   , CHANGELOG.md+tested-with:         GHC == 8.0.2+                   , GHC == 8.2.2+                   , GHC == 8.4.4+                   , GHC == 8.6.5+                   , GHC == 8.8.4+                   , GHC == 8.10.4+                   , GHC == 9.0.1++source-repository head+  type:                git+  location:            https://github.com/hslua/hslua.git++common common-options+  default-language:    Haskell2010+  build-depends:       base          >= 4.8    && < 5+                     , lua           >= 2.0    && < 2.1+                     , QuickCheck    >= 2.7    && < 3+  ghc-options:         -Wall+                       -Wincomplete-record-updates+                       -Wnoncanonical-monad-instances+                       -Wredundant-constraints+  if impl(ghc >= 8.2)+    ghc-options:         -Wcpp-undef+                         -Werror=missing-home-modules+  if impl(ghc >= 8.4)+    ghc-options:         -Widentities+                         -Wincomplete-uni-patterns+                         -Wpartial-fields+                         -fhide-source-paths++library+  import:              common-options+  exposed-modules:     Lua.Arbitrary+  hs-source-dirs:      src
+ src/Lua/Arbitrary.hs view
@@ -0,0 +1,45 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-| Instances for QuickCheck's Arbitrary. -}+module Lua.Arbitrary () where++import Lua+import Test.QuickCheck++instance Arbitrary Lua.Integer where+  arbitrary = arbitrarySizedIntegral++instance Arbitrary Lua.Number where+  arbitrary = Lua.Number <$> arbitrary++instance Arbitrary Lua.TypeCode where+  arbitrary = elements+    [ LUA_TNONE+    , LUA_TNIL+    , LUA_TBOOLEAN+    , LUA_TLIGHTUSERDATA+    , LUA_TNUMBER+    , LUA_TSTRING+    , LUA_TTABLE+    , LUA_TFUNCTION+    , LUA_TUSERDATA+    , LUA_TTHREAD+    ]++instance Arbitrary Lua.StatusCode where+  arbitrary = elements+    [ LUA_OK+    , LUA_YIELD+    , LUA_ERRRUN+    , LUA_ERRSYNTAX+    , LUA_ERRMEM+    , LUA_ERRGCMM+    , LUA_ERRERR+    , LUA_ERRFILE+    ]++instance Arbitrary Lua.OPCode where+  arbitrary = elements+    [ LUA_OPEQ+    , LUA_OPLT+    , LUA_OPLE+    ]