Questions tagged [liquid-haskell]

For questions pertaining to the LiquidHaskell static verifier.

LiquidHaskell is a static verifier which works with the Haskell language.

LiquidHaskell itself is based upon Liquid Types, and aims to help write memory-safe, but also provably correct programs by allowing users to annotate types with logical constraints which can later be solved using SMT solvers.

37 questions
1
vote
2 answers

Why does LiquidHaskell fail to take guard into account?

I am following the Liquid Haskell tutorial: http://ucsd-progsys.github.io/liquidhaskell-tutorial/04-poly.html and this example fails: module Test2 where import Data.Vector import Prelude hiding (length) vectorSum :: Vector Int -> Int vectorSum…
mbrodersen
  • 787
  • 4
  • 17
1
vote
0 answers

How to install liquid haskell in ubuntu 18.04?

I am struggling to install liquid Haskell in Ubuntu 18.04. I have tried few commands to install the dependencies and now getting the error in the final compilation of liquid Haskell. I am using following command for the installation: cabal install…
Baber
  • 301
  • 2
  • 6
  • 17
1
vote
2 answers

Returning a subset of types in Haskell

I'm trying to restrict the return type of a function to a subset of (kind) constructors. I can use typeclasses to restrict the input types, but when I try the same technique on return types as shown below, I get a Couldn't match type ‘s’ with ‘'A’…
Thales MG
  • 761
  • 5
  • 15
0
votes
1 answer

LiquidHaskell: Functor Law

I am encoding (as an assumption) the functor identity law like so: ... import qualified Prelude () ... {-@ class Functor f where fmap :: forall a b. (a -> b) -> (f a -> f b) @-} class Functor f where fmap :: (a -> b) -> (f a -> f b) --…
0
votes
1 answer

Can't prove unique refinement type for filter function

I am following the LH tutorial and am stuck at the excersise to refine the type of the filter function in a way that, if called with a list with unique elements, the output is also a unique list with unique elements. This is the code I am working…
Fabian Schneider
  • 799
  • 1
  • 13
  • 40
0
votes
0 answers

Canonical way to fix error with Data.Text.head in Liquid Haskell?

I have code: myfun c t = if c == '/' && T.length t > 0 && '/' == T.head t then t else T.singleton c <> t When I run LH on it (stack exec liquid -- MyFile.hs) I get error: Error: Liquid Type Mismatch 35 | rmSlash c t = if c == '/' &&…
RandomB
  • 3,367
  • 19
  • 30
0
votes
1 answer

Are these examples correct or the tutorial has an error?

I am reading this tutorial and I am not sure that I understand correctly the text (or that it is correct at whole). There is an example: The following predicates are valid because they encode modus ponens: if you know that a implies b and you…
RandomB
  • 3,367
  • 19
  • 30
1 2
3