packages feed

liquidhaskell-cabal-demo (empty) → 0.1.1.0

raw patch · 8 files changed

+131/−0 lines, 8 filesdep +basedep +liquidhaskell-cabalbuild-type:Customsetup-changed

Dependencies added: base, liquidhaskell-cabal

Files

+ LICENSE view
@@ -0,0 +1,28 @@+Copyright (c) 2016, Michael Smith+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++* Redistributions of source code must retain the above copyright notice, this+  list of conditions and the following disclaimer.++* Redistributions in binary form must reproduce the above copyright notice,+  this list of conditions and the following disclaimer in the documentation+  and/or other materials provided with the distribution.++* Neither the name of liquidhaskell-cabal nor the names of its+  contributors may be used to endorse or promote products derived from+  this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+
+ Setup.hs view
@@ -0,0 +1,2 @@+import LiquidHaskell.Cabal+main = liquidHaskellMain
+ app/FFI.hs view
@@ -0,0 +1,16 @@+import Foreign.C.Types++{-@ embed CInt as int @-}+{-@ embed Integer as int @-}++{-@ assume c_foo :: x:{CInt | x > 0} -> IO {v:CInt | v = x} @-}+foreign import ccall unsafe "foo.c foo" c_foo+  :: CInt -> IO CInt++main :: IO ()+main = print =<< foo 1++{-@ foo :: x:{Int | x > 0} -> IO Int @-}+foo :: Int -> IO Int+foo = fmap fromIntegral . c_foo . fromIntegral+
+ include/foo.c view
@@ -0,0 +1,4 @@+#include "foo.h"+int foo(int x) {+  return x;+}
+ liquidhaskell-cabal-demo.cabal view
@@ -0,0 +1,57 @@+name:                     liquidhaskell-cabal-demo+version:                  0.1.1.0+synopsis:                 Demo of Liquid Haskell integration for Cabal and stack+description:              Please see the+                          <https://github.com/spinda/liquidhaskell-cabal-demo/blob/0.1.1.0/README.md README>+                          on GitHub for more information.+homepage:                 https://github.com/spinda/liquidhaskell-cabal-demo#readme+bug-reports:              https://github.com/spinda/liquidhaskell-cabal-demo/issues+license:                  BSD3+license-file:             LICENSE+author:                   Michael Smith+maintainer:               Michael Smith <michael@spinda.net>+copyright:                2016 Michael Smith+category:                 Development+cabal-version:            >=1.10+build-type:               Custom++-- Unfortunately this won't work until Cabal 1.24 is released.+--+-- custom-setup+--   setup-depends:           base, Cabal, liquidhaskell-cabal++flag liquidhaskell+  description:             After building, verify with LiquidHaskell+  default:                 False++library+  exposed-modules:         A, B, C+  build-depends:           base >=4.8 && <5+                         , liquidhaskell-cabal >= 0.1.1 && < 0.2+  hs-source-dirs:          src+  default-language:        Haskell2010+  default-extensions:      TupleSections+  ghc-options:             -rtsopts+                           -with-rtsopts=-N+                           -Wall+  x-liquidhaskell-options: --diff --no-termination++executable ffi+  main-is:                 FFI.hs+  build-depends:           base >=4.8 && <5+                         , liquidhaskell-cabal >= 0.1.1 && < 0.2+  hs-source-dirs:          app+  default-language:        Haskell2010+  default-extensions:      ForeignFunctionInterface+  include-dirs:            include+  c-sources:               include/foo.c+  ghc-options:             -threaded+                           -rtsopts+                           -with-rtsopts=-N+                           -Wall+  x-liquidhaskell-options: --diff++source-repository head+  type:                git+  location:            https://github.com/spinda/liquidhaskell-cabal-demo+
+ src/A.hs view
@@ -0,0 +1,9 @@+module A where++{-@ plus :: x:Int -> y:Int -> {v:Int | v = x + y} @-}+plus :: Int -> Int -> Int+plus x y = x + y++test :: String -> (String, String)+test = ("test", )+
+ src/B.hs view
@@ -0,0 +1,6 @@+module B where++{-@ minus :: x:Int -> y:Int -> {v:Int | v = x - y} @-}+minus :: Int -> Int -> Int+minus x y = x - y+
+ src/C.hs view
@@ -0,0 +1,9 @@+module C where++import A+import B++{-@ quux :: x:Int -> y:Int -> z:Int -> {v:Int | v = x + y - z} @-}+quux :: Int -> Int -> Int -> Int+quux x y z = x `plus` y `minus` z+