{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wall -Werror #-}
module Data.SBV.String (
length, null
, head, tail, uncons, init, singleton, strToStrAt, strToCharAt, (!!), implode, concat, (.:), snoc, nil, (++)
, isInfixOf, isSuffixOf, isPrefixOf
, take, drop, subStr, replace, indexOf, offsetIndexOf
, reverse
, strToNat, natToStr
) where
import Prelude hiding (head, tail, init, length, take, drop, concat, null, reverse, (++), (!!))
import qualified Prelude as P
import Data.SBV.Core.Data hiding (SeqOp(..))
import Data.SBV.Core.Data (SeqOp(SBVReverse))
import Data.SBV.Core.Model
import qualified Data.Char as C
import Data.List (genericLength, genericIndex, genericDrop, genericTake)
import qualified Data.List as L (tails, isSuffixOf, isPrefixOf, isInfixOf)
import Data.Proxy
length :: SString -> SInteger
length :: SString -> SInteger
length = forall a b.
(SymVal a, SymVal b) =>
StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 StrOp
StrLen (forall a. a -> Maybe a
Just (forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => t a -> Int
P.length))
null :: SString -> SBool
null :: SString -> SBool
null SString
s
| Just String
cs <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
= forall a. SymVal a => a -> SBV a
literal (forall (t :: * -> *) a. Foldable t => t a -> Bool
P.null String
cs)
| Bool
True
= SString
s forall a. EqSymbolic a => a -> a -> SBool
.== forall a. SymVal a => a -> SBV a
literal String
""
head :: SString -> SChar
head :: SString -> SChar
head = (SString -> SInteger -> SChar
`strToCharAt` SInteger
0)
tail :: SString -> SString
tail :: SString -> SString
tail SString
s
| Just (Char
_:String
cs) <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
= forall a. SymVal a => a -> SBV a
literal String
cs
| Bool
True
= SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
1 (SString -> SInteger
length SString
s forall a. Num a => a -> a -> a
- SInteger
1)
uncons :: SString -> (SChar, SString)
uncons :: SString -> (SChar, SString)
uncons SString
l = (SString -> SChar
head SString
l, SString -> SString
tail SString
l)
init :: SString -> SString
init :: SString -> SString
init SString
s
| Just cs :: String
cs@(Char
_:String
_) <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
= forall a. SymVal a => a -> SBV a
literal forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [a]
P.init String
cs
| Bool
True
= SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
0 (SString -> SInteger
length SString
s forall a. Num a => a -> a -> a
- SInteger
1)
singleton :: SChar -> SString
singleton :: SChar -> SString
singleton = forall a b.
(SymVal a, SymVal b) =>
StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 StrOp
StrUnit (forall a. a -> Maybe a
Just forall {a}. a -> [a]
wrap)
where wrap :: a -> [a]
wrap a
c = [a
c]
strToStrAt :: SString -> SInteger -> SString
strToStrAt :: SString -> SInteger -> SString
strToStrAt SString
s SInteger
offset = SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
offset SInteger
1
strToCharAt :: SString -> SInteger -> SChar
strToCharAt :: SString -> SInteger -> SChar
strToCharAt SString
s SInteger
i
| Just String
cs <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s, Just Integer
ci <- forall a. SymVal a => SBV a -> Maybe a
unliteral SInteger
i, Integer
ci forall a. Ord a => a -> a -> Bool
>= Integer
0, Integer
ci forall a. Ord a => a -> a -> Bool
< forall i a. Num i => [a] -> i
genericLength String
cs, let c :: Int
c = Char -> Int
C.ord (String
cs forall i a. Integral i => [a] -> i -> a
`genericIndex` Integer
ci)
= forall a. SymVal a => a -> SBV a
literal (Int -> Char
C.chr Int
c)
| Bool
True
= forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
StrNth forall a. Maybe a
Nothing SString
s SInteger
i
(!!) :: SString -> SInteger -> SChar
!! :: SString -> SInteger -> SChar
(!!) = SString -> SInteger -> SChar
strToCharAt
implode :: [SChar] -> SString
implode :: [SChar] -> SString
implode = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (SString -> SString -> SString
(++) forall b c a. (b -> c) -> (a -> b) -> a -> c
. SChar -> SString
singleton) SString
""
infixr 5 .:
(.:) :: SChar -> SString -> SString
SChar
c .: :: SChar -> SString -> SString
.: SString
cs = SChar -> SString
singleton SChar
c SString -> SString -> SString
++ SString
cs
snoc :: SString -> SChar -> SString
SString
s snoc :: SString -> SChar -> SString
`snoc` SChar
c = SString
s SString -> SString -> SString
++ SChar -> SString
singleton SChar
c
nil :: SString
nil :: SString
nil = SString
""
concat :: SString -> SString -> SString
concat :: SString -> SString -> SString
concat SString
x SString
y | SString -> Bool
isConcretelyEmpty SString
x = SString
y
| SString -> Bool
isConcretelyEmpty SString
y = SString
x
| Bool
True = forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
StrConcat (forall a. a -> Maybe a
Just forall a. [a] -> [a] -> [a]
(P.++)) SString
x SString
y
infixr 5 ++
(++) :: SString -> SString -> SString
++ :: SString -> SString -> SString
(++) = SString -> SString -> SString
concat
isInfixOf :: SString -> SString -> SBool
SString
sub isInfixOf :: SString -> SString -> SBool
`isInfixOf` SString
s
| SString -> Bool
isConcretelyEmpty SString
sub
= forall a. SymVal a => a -> SBV a
literal Bool
True
| Bool
True
= forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
StrContains (forall a. a -> Maybe a
Just (forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a. Eq a => [a] -> [a] -> Bool
L.isInfixOf)) SString
s SString
sub
isPrefixOf :: SString -> SString -> SBool
SString
pre isPrefixOf :: SString -> SString -> SBool
`isPrefixOf` SString
s
| SString -> Bool
isConcretelyEmpty SString
pre
= forall a. SymVal a => a -> SBV a
literal Bool
True
| Bool
True
= forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
StrPrefixOf (forall a. a -> Maybe a
Just forall a. Eq a => [a] -> [a] -> Bool
L.isPrefixOf) SString
pre SString
s
isSuffixOf :: SString -> SString -> SBool
SString
suf isSuffixOf :: SString -> SString -> SBool
`isSuffixOf` SString
s
| SString -> Bool
isConcretelyEmpty SString
suf
= forall a. SymVal a => a -> SBV a
literal Bool
True
| Bool
True
= forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
StrSuffixOf (forall a. a -> Maybe a
Just forall a. Eq a => [a] -> [a] -> Bool
L.isSuffixOf) SString
suf SString
s
take :: SInteger -> SString -> SString
take :: SInteger -> SString -> SString
take SInteger
i SString
s = forall a. Mergeable a => SBool -> a -> a -> a
ite (SInteger
i forall a. OrdSymbolic a => a -> a -> SBool
.<= SInteger
0) (forall a. SymVal a => a -> SBV a
literal String
"")
forall a b. (a -> b) -> a -> b
$ forall a. Mergeable a => SBool -> a -> a -> a
ite (SInteger
i forall a. OrdSymbolic a => a -> a -> SBool
.>= SString -> SInteger
length SString
s) SString
s
forall a b. (a -> b) -> a -> b
$ SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
0 SInteger
i
drop :: SInteger -> SString -> SString
drop :: SInteger -> SString -> SString
drop SInteger
i SString
s = forall a. Mergeable a => SBool -> a -> a -> a
ite (SInteger
i forall a. OrdSymbolic a => a -> a -> SBool
.>= SInteger
ls) (forall a. SymVal a => a -> SBV a
literal String
"")
forall a b. (a -> b) -> a -> b
$ forall a. Mergeable a => SBool -> a -> a -> a
ite (SInteger
i forall a. OrdSymbolic a => a -> a -> SBool
.<= SInteger
0) SString
s
forall a b. (a -> b) -> a -> b
$ SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
i (SInteger
ls forall a. Num a => a -> a -> a
- SInteger
i)
where ls :: SInteger
ls = SString -> SInteger
length SString
s
subStr :: SString -> SInteger -> SInteger -> SString
subStr :: SString -> SInteger -> SInteger -> SString
subStr SString
s SInteger
offset SInteger
len
| Just String
c <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
, Just Integer
o <- forall a. SymVal a => SBV a -> Maybe a
unliteral SInteger
offset
, Just Integer
l <- forall a. SymVal a => SBV a -> Maybe a
unliteral SInteger
len
, let lc :: Integer
lc = forall i a. Num i => [a] -> i
genericLength String
c
, let valid :: Integer -> Bool
valid Integer
x = Integer
x forall a. Ord a => a -> a -> Bool
>= Integer
0 Bool -> Bool -> Bool
&& Integer
x forall a. Ord a => a -> a -> Bool
<= Integer
lc
, Integer -> Bool
valid Integer
o
, Integer
l forall a. Ord a => a -> a -> Bool
>= Integer
0
, Integer -> Bool
valid forall a b. (a -> b) -> a -> b
$ Integer
o forall a. Num a => a -> a -> a
+ Integer
l
= forall a. SymVal a => a -> SBV a
literal forall a b. (a -> b) -> a -> b
$ forall i a. Integral i => i -> [a] -> [a]
genericTake Integer
l forall a b. (a -> b) -> a -> b
$ forall i a. Integral i => i -> [a] -> [a]
genericDrop Integer
o String
c
| Bool
True
= forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
StrOp
-> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d
lift3 StrOp
StrSubstr forall a. Maybe a
Nothing SString
s SInteger
offset SInteger
len
replace :: SString -> SString -> SString -> SString
replace :: SString -> SString -> SString -> SString
replace SString
s SString
src SString
dst
| Just String
b <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
src, forall (t :: * -> *) a. Foldable t => t a -> Bool
P.null String
b
= SString
dst SString -> SString -> SString
++ SString
s
| Just String
a <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
, Just String
b <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
src
, Just String
c <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
dst
= forall a. SymVal a => a -> SBV a
literal forall a b. (a -> b) -> a -> b
$ forall {a}. Eq a => [a] -> [a] -> [a] -> [a]
walk String
a String
b String
c
| Bool
True
= forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
StrOp
-> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d
lift3 StrOp
StrReplace forall a. Maybe a
Nothing SString
s SString
src SString
dst
where walk :: [a] -> [a] -> [a] -> [a]
walk [a]
haystack [a]
needle [a]
newNeedle = [a] -> [a]
go [a]
haystack
where go :: [a] -> [a]
go [] = []
go i :: [a]
i@(a
c:[a]
cs)
| [a]
needle forall a. Eq a => [a] -> [a] -> Bool
`L.isPrefixOf` [a]
i = [a]
newNeedle forall a. [a] -> [a] -> [a]
P.++ forall i a. Integral i => i -> [a] -> [a]
genericDrop (forall i a. Num i => [a] -> i
genericLength [a]
needle :: Integer) [a]
i
| Bool
True = a
c forall a. a -> [a] -> [a]
: [a] -> [a]
go [a]
cs
indexOf :: SString -> SString -> SInteger
indexOf :: SString -> SString -> SInteger
indexOf SString
s SString
sub = SString -> SString -> SInteger -> SInteger
offsetIndexOf SString
s SString
sub SInteger
0
offsetIndexOf :: SString -> SString -> SInteger -> SInteger
offsetIndexOf :: SString -> SString -> SInteger -> SInteger
offsetIndexOf SString
s SString
sub SInteger
offset
| Just String
c <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
, Just String
n <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
sub
, Just Integer
o <- forall a. SymVal a => SBV a -> Maybe a
unliteral SInteger
offset
, Integer
o forall a. Ord a => a -> a -> Bool
>= Integer
0, Integer
o forall a. Ord a => a -> a -> Bool
<= forall i a. Num i => [a] -> i
genericLength String
c
= case [Integer
i | (Integer
i, String
t) <- forall a b. [a] -> [b] -> [(a, b)]
zip [Integer
o ..] (forall a. [a] -> [[a]]
L.tails (forall i a. Integral i => i -> [a] -> [a]
genericDrop Integer
o String
c)), String
n forall a. Eq a => [a] -> [a] -> Bool
`L.isPrefixOf` String
t] of
(Integer
i:[Integer]
_) -> forall a. SymVal a => a -> SBV a
literal Integer
i
[Integer]
_ -> -SInteger
1
| Bool
True
= forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
StrOp
-> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d
lift3 StrOp
StrIndexOf forall a. Maybe a
Nothing SString
s SString
sub SInteger
offset
reverse :: SString -> SString
reverse :: SString -> SString
reverse SString
s
| Just String
s' <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
= forall a. SymVal a => a -> SBV a
literal (forall a. [a] -> [a]
P.reverse String
s')
| Bool
True
= forall a. SVal -> SBV a
SBV forall a b. (a -> b) -> a -> b
$ Kind -> Either CV (Cached SV) -> SVal
SVal Kind
KString forall a b. (a -> b) -> a -> b
$ forall a b. b -> Either a b
Right forall a b. (a -> b) -> a -> b
$ forall a. (State -> IO a) -> Cached a
cache State -> IO SV
r
where r :: State -> IO SV
r State
st = do SV
sva <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SString
s
State -> Kind -> SBVExpr -> IO SV
newExpr State
st Kind
KString (Op -> [SV] -> SBVExpr
SBVApp (SeqOp -> Op
SeqOp (Kind -> SeqOp
SBVReverse Kind
KString)) [SV
sva])
strToNat :: SString -> SInteger
strToNat :: SString -> SInteger
strToNat SString
s
| Just String
a <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
s
= if forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
C.isDigit String
a Bool -> Bool -> Bool
&& Bool -> Bool
not (forall (t :: * -> *) a. Foldable t => t a -> Bool
P.null String
a)
then forall a. SymVal a => a -> SBV a
literal (forall a. Read a => String -> a
read String
a)
else -SInteger
1
| Bool
True
= forall a b.
(SymVal a, SymVal b) =>
StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 StrOp
StrStrToNat forall a. Maybe a
Nothing SString
s
natToStr :: SInteger -> SString
natToStr :: SInteger -> SString
natToStr SInteger
i
| Just Integer
v <- forall a. SymVal a => SBV a -> Maybe a
unliteral SInteger
i
= forall a. SymVal a => a -> SBV a
literal forall a b. (a -> b) -> a -> b
$ if Integer
v forall a. Ord a => a -> a -> Bool
>= Integer
0 then forall a. Show a => a -> String
show Integer
v else String
""
| Bool
True
= forall a b.
(SymVal a, SymVal b) =>
StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 StrOp
StrNatToStr forall a. Maybe a
Nothing SInteger
i
lift1 :: forall a b. (SymVal a, SymVal b) => StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 :: forall a b.
(SymVal a, SymVal b) =>
StrOp -> Maybe (a -> b) -> SBV a -> SBV b
lift1 StrOp
w Maybe (a -> b)
mbOp SBV a
a
| Just SBV b
cv <- forall a b.
(SymVal a, SymVal b) =>
Maybe (a -> b) -> SBV a -> Maybe (SBV b)
concEval1 Maybe (a -> b)
mbOp SBV a
a
= SBV b
cv
| Bool
True
= forall a. SVal -> SBV a
SBV forall a b. (a -> b) -> a -> b
$ Kind -> Either CV (Cached SV) -> SVal
SVal Kind
k forall a b. (a -> b) -> a -> b
$ forall a b. b -> Either a b
Right forall a b. (a -> b) -> a -> b
$ forall a. (State -> IO a) -> Cached a
cache State -> IO SV
r
where k :: Kind
k = forall a. HasKind a => a -> Kind
kindOf (forall {k} (t :: k). Proxy t
Proxy @b)
r :: State -> IO SV
r State
st = do SV
sva <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV a
a
State -> Kind -> SBVExpr -> IO SV
newExpr State
st Kind
k (Op -> [SV] -> SBVExpr
SBVApp (StrOp -> Op
StrOp StrOp
w) [SV
sva])
lift2 :: forall a b c. (SymVal a, SymVal b, SymVal c) => StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 :: forall a b c.
(SymVal a, SymVal b, SymVal c) =>
StrOp -> Maybe (a -> b -> c) -> SBV a -> SBV b -> SBV c
lift2 StrOp
w Maybe (a -> b -> c)
mbOp SBV a
a SBV b
b
| Just SBV c
cv <- forall a b c.
(SymVal a, SymVal b, SymVal c) =>
Maybe (a -> b -> c) -> SBV a -> SBV b -> Maybe (SBV c)
concEval2 Maybe (a -> b -> c)
mbOp SBV a
a SBV b
b
= SBV c
cv
| Bool
True
= forall a. SVal -> SBV a
SBV forall a b. (a -> b) -> a -> b
$ Kind -> Either CV (Cached SV) -> SVal
SVal Kind
k forall a b. (a -> b) -> a -> b
$ forall a b. b -> Either a b
Right forall a b. (a -> b) -> a -> b
$ forall a. (State -> IO a) -> Cached a
cache State -> IO SV
r
where k :: Kind
k = forall a. HasKind a => a -> Kind
kindOf (forall {k} (t :: k). Proxy t
Proxy @c)
r :: State -> IO SV
r State
st = do SV
sva <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV a
a
SV
svb <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV b
b
State -> Kind -> SBVExpr -> IO SV
newExpr State
st Kind
k (Op -> [SV] -> SBVExpr
SBVApp (StrOp -> Op
StrOp StrOp
w) [SV
sva, SV
svb])
lift3 :: forall a b c d. (SymVal a, SymVal b, SymVal c, SymVal d) => StrOp -> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d
lift3 :: forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
StrOp
-> Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> SBV d
lift3 StrOp
w Maybe (a -> b -> c -> d)
mbOp SBV a
a SBV b
b SBV c
c
| Just SBV d
cv <- forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
Maybe (a -> b -> c -> d)
-> SBV a -> SBV b -> SBV c -> Maybe (SBV d)
concEval3 Maybe (a -> b -> c -> d)
mbOp SBV a
a SBV b
b SBV c
c
= SBV d
cv
| Bool
True
= forall a. SVal -> SBV a
SBV forall a b. (a -> b) -> a -> b
$ Kind -> Either CV (Cached SV) -> SVal
SVal Kind
k forall a b. (a -> b) -> a -> b
$ forall a b. b -> Either a b
Right forall a b. (a -> b) -> a -> b
$ forall a. (State -> IO a) -> Cached a
cache State -> IO SV
r
where k :: Kind
k = forall a. HasKind a => a -> Kind
kindOf (forall {k} (t :: k). Proxy t
Proxy @d)
r :: State -> IO SV
r State
st = do SV
sva <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV a
a
SV
svb <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV b
b
SV
svc <- forall a. State -> SBV a -> IO SV
sbvToSV State
st SBV c
c
State -> Kind -> SBVExpr -> IO SV
newExpr State
st Kind
k (Op -> [SV] -> SBVExpr
SBVApp (StrOp -> Op
StrOp StrOp
w) [SV
sva, SV
svb, SV
svc])
concEval1 :: (SymVal a, SymVal b) => Maybe (a -> b) -> SBV a -> Maybe (SBV b)
concEval1 :: forall a b.
(SymVal a, SymVal b) =>
Maybe (a -> b) -> SBV a -> Maybe (SBV b)
concEval1 Maybe (a -> b)
mbOp SBV a
a = forall a. SymVal a => a -> SBV a
literal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Maybe (a -> b)
mbOp forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV a
a)
concEval2 :: (SymVal a, SymVal b, SymVal c) => Maybe (a -> b -> c) -> SBV a -> SBV b -> Maybe (SBV c)
concEval2 :: forall a b c.
(SymVal a, SymVal b, SymVal c) =>
Maybe (a -> b -> c) -> SBV a -> SBV b -> Maybe (SBV c)
concEval2 Maybe (a -> b -> c)
mbOp SBV a
a SBV b
b = forall a. SymVal a => a -> SBV a
literal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Maybe (a -> b -> c)
mbOp forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV b
b)
concEval3 :: (SymVal a, SymVal b, SymVal c, SymVal d) => Maybe (a -> b -> c -> d) -> SBV a -> SBV b -> SBV c -> Maybe (SBV d)
concEval3 :: forall a b c d.
(SymVal a, SymVal b, SymVal c, SymVal d) =>
Maybe (a -> b -> c -> d)
-> SBV a -> SBV b -> SBV c -> Maybe (SBV d)
concEval3 Maybe (a -> b -> c -> d)
mbOp SBV a
a SBV b
b SBV c
c = forall a. SymVal a => a -> SBV a
literal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Maybe (a -> b -> c -> d)
mbOp forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV b
b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. SymVal a => SBV a -> Maybe a
unliteral SBV c
c)
isConcretelyEmpty :: SString -> Bool
isConcretelyEmpty :: SString -> Bool
isConcretelyEmpty SString
ss | Just String
s <- forall a. SymVal a => SBV a -> Maybe a
unliteral SString
ss = forall (t :: * -> *) a. Foldable t => t a -> Bool
P.null String
s
| Bool
True = Bool
False
{-# ANN implode ("HLint: ignore Use concatMap" :: String) #-}