====== {-# OPTIONS_GHC -fno-warn-missing-signatures #-} ======
* Prevents warnings of top level functions which have no type signature.
* NOTE: For better readability, sometimes it makes sense not to declate the type of top level functions and letting the compiler to infer the type.
* expample:
...
import Parser
...
synMain = SynSeq [synNumber, synComment, synNumber, SynEOI]
synComment = SynSeq [ synCommentBegin, synNotCommentEnds, synCommentEnd]
synCommentBegin = SynSeq [SynChar '{', SynChar '-']
synCommentEnd = SynSeq [SynChar '-', SynChar '}']
synNotCommentEnds = SynRep synNotCommentEnd
synNotCommentEnd = SynAbs synCommentEnd
synNumber = SynSel [synNumberZero,synNonZeroNumber]
synNumberZero = SynChar '0'
synNonZeroNumber = SynSeq [synNonZeroDigit, SynRep synDigit]
synNonZeroDigit = SynSel (map SynChar ['1'..'9'])
synDigit = SynSel (map SynChar ['0'..'9'])
* compiler warning, when using -Wall:
app\Main.hs:59:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: synMain :: Syntax
|
59 | synMain = SynSeq [synNumber, synComment, synNumber, SynEOI]
| ^^^^^^^
* expample:
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
...
import Parser
...
synMain = SynSeq [synNumber, synComment, synNumber, SynEOI]
synComment = SynSeq [ synCommentBegin, synNotCommentEnds, synCommentEnd]
synCommentBegin = SynSeq [SynChar '{', SynChar '-']
synCommentEnd = SynSeq [SynChar '-', SynChar '}']
synNotCommentEnds = SynRep synNotCommentEnd
synNotCommentEnd = SynAbs synCommentEnd
synNumber = SynSel [synNumberZero,synNonZeroNumber]
synNumberZero = SynChar '0'
synNonZeroNumber = SynSeq [synNonZeroDigit, SynRep synDigit]
synNonZeroDigit = SynSel (map SynChar ['1'..'9'])
synDigit = SynSel (map SynChar ['0'..'9'])
* compiles, error and warning free, with compiler: GHC 9.0.2, using compiler option -Wall
===== ✎ =====
~~DISCUSSION~~