-
Notifications
You must be signed in to change notification settings - Fork 5
Strong types for logical operators #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, I can adjust this to make the types more narrow.
http://hackage.haskell.org/package/base-4.12.0.0/docs/Foreign-C-Types.html#t:CBool Note af_err af_lt (af_array *out, const af_array lhs, const af_array rhs, const bool batch); The We could attempt to munge the two. That's more or less what I've done with the instance (AFType a, Eq a) => Eq (Array a) where
x == y = toEnum . fromIntegral $ A.getScalar @CBool @a $! A.eq x y
x /= y = toEnum . fromIntegral $ A.getScalar @CBool @a $! A.neq x y Come to think of it. I bet we should be using |
Since |
#24 should solve all our problems, please review and re-open this issue if it does not. |
For example
lt
,gt
,le
,ge
,eq
,neq
should have typeAFType a => Array a -> Array a -> Array CBool
.And functions like
and
,or
should have typeArray CBool -> Array CBool -> Array CBool
.And
not
should have typeArray CBool -> Array CBool
.By the way why is
Bool
not an instance ofAFType
? Would it be possible to write an instance that usesCBool
under the hood?The text was updated successfully, but these errors were encountered: