User Tools

Site Tools


codesnippets:fnowarnmissingsignatures

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
codesnippets:fnowarnmissingsignatures [2022/04/29 00:04] f2b216codesnippets:fnowarnmissingsignatures [2025/10/08 00:48] (current) – external edit 127.0.0.1
Line 4: Line 4:
   * 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.   * 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:<code Haskell>   * expample:<code Haskell>
 +...
 +
 +import Parser
 +
 +...
 +
 synMain = SynSeq [synNumber, synComment, synNumber, SynEOI] synMain = SynSeq [synNumber, synComment, synNumber, SynEOI]
 synComment = SynSeq [ synCommentBegin, synNotCommentEnds, synCommentEnd] synComment = SynSeq [ synCommentBegin, synNotCommentEnds, synCommentEnd]
Line 16: Line 22:
 synDigit = SynSel (map SynChar ['0'..'9']) synDigit = SynSel (map SynChar ['0'..'9'])
 </code> </code>
 +  * compiler warning, when using -Wall:<code>
 +app\Main.hs:59:1: warning: [-Wmissing-signatures]
 +    Top-level binding with no type signature: synMain :: Syntax
 +   |
 +59 | synMain = SynSeq [synNumber, synComment, synNumber, SynEOI]
 +   | ^^^^^^^
 +</code>
 +  * expample:<code Haskell>
 +{-# 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'])
 +</code>
 +    * compiles, error and warning free, with compiler: GHC 9.0.2, using compiler option -Wall
 +
 +
 +===== ✎ =====
 +~~DISCUSSION~~
codesnippets/fnowarnmissingsignatures.1651183451.txt.gz · Last modified: (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki