ollef / Earley

Parsing all context-free grammars using Earley's algorithm in Haskell.
BSD 3-Clause "New" or "Revised" License
363 stars 24 forks source link

Unusable {-# UNPACK #-} pragmas. #1

Closed chowells79 closed 9 years ago

chowells79 commented 9 years ago
[2 of 4] Compiling Text.Earley.Parser ( Text/Earley/Parser.hs, dist/build/Text/Earley/Parser.o )

Text/Earley/Parser.hs:83:3: Warning:
    Ignoring unusable UNPACK pragma on the third argument of ‘State’
    In the definition of data constructor ‘State’
    In the data declaration for ‘State’

Text/Earley/Parser.hs:92:3: Warning:
    Ignoring unusable UNPACK pragma on the second argument of ‘Cont’
    In the definition of data constructor ‘Cont’
    In the data declaration for ‘Cont’

Text/Earley/Parser.hs:92:3: Warning:
    Ignoring unusable UNPACK pragma on the fourth argument of ‘Cont’
    In the definition of data constructor ‘Cont’
    In the data declaration for ‘Cont’

In all cases, those arguments are Arg values, and Arg is a type alias for a function type. Function types can't be unpacked, since they aren't thin wrappers around primitives.

ollef commented 9 years ago

Thanks for your report.

You're right. In fact, I just realised that the cabal file gives the -funbox-strict-fields flag so all UNPACKs could probably be removed. Out of interest, what version of GHC are you using? I'm not getting those warnings even with -Wall running 7.10.1.

ollef commented 9 years ago

Fixed by 6fc5388db9365267618321b52f17792c6f30423c.

chowells79 commented 9 years ago

GHC 7.10.1, just building with cabal. Not sure why I got the warnings and you didn't.