Skip to content

Haskell: bitwise_ops regex has a typo (.&&. for .&.), arch_io counts the IO type, decorators ignores pragmas #8904

Done

Description

@squid-protocol

What is wrong

Three Haskell families disagree with their contracts. Found with a Haskell oracle on pandoc's src/ (5,099 functions matched; args 0.97 / 1.00 and branch 0.93 / 0.99, so the oracle reads functions correctly):

  1. bitwise_ops never matches .&. or .|.. The rule (haskell.py, bitwise_ops) ends ...|\.&&\.|\|\.\|\|\., which matches .&&. and .||., operators that do not exist; the Data.Bits operators are .&. and .|. (a typo of doubled characters).
  2. arch_io counts the type IO in a signature. hs_io :: Int -> IO Int scores arch_io == 1. A type in a signature is not an operation that moves data between the program and the outside; the contract is about the operation ("at its invocation").
  3. decorators is dead: {-# INLINE hs_inl #-} scores 0, although the decorators contract names "an annotation, attribute, pragma or directive line".

A fourth point is a question, not a bug: monadic error raising (throwError, fail, ioError) is not in panics_and_aborts ("a throw or raise ... or process-exit call"); they account for the whole recall gap (0.11) of that family on pandoc.

Reproduce

hs_bits :: Int -> Int
hs_bits x = x .&. 3                  -- bitwise_ops == 0, should be 1

hs_io :: Int -> IO Int
hs_io x = return x                   -- arch_io == 1, should be 0 (no I/O operation, only the type)

{-# INLINE hs_inl #-}
hs_inl :: Int -> Int
hs_inl x = x + 1                     -- struct_decorators == 0, should be 1

hs_err :: Int -> Either String Int
hs_err x = throwError "bad"          -- state_bailout_hits == 0 (question: is throwError a raise?)

Expected

bitwise_ops matches .&., .|., xor, shiftL/shiftR, complement (fix the typo); arch_io is anchored on an I/O call (readFile, hGetLine, putStrLn, ...) and not on the IO type; decorators counts {-# ... #-} pragmas attached to a binding; the throwError/fail question is answered in #8862.

Part of #8863. Time the change; rosetta:rebless-owed if counts move; add each case above as a test.

Activity

  1. added
    bug
    core-engine
    on Nov 21, 2026
  2. squid-protocol commented on Nov 23, 2026

    @squid-protocol
    OwnerAuthor

    This issue's PR content landed via #9111 (merged as fcc440b). It was a 'Part of' change, so the issue stays open for the remaining work.

  3. squid-protocol commented on Nov 24, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-24T12:53Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

  4. squid-protocol commented on Nov 24, 2026

    @squid-protocol
    OwnerAuthor

    Closing: the three defects landed in #9111 and the I/O recall gap in #9193. The fourth point (monadic raises in panics_and_aborts: recommend throwError and ioError, not bare fail) is a question for #8862, recorded in #9193.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclaim:melekcore-enginepriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions