TDNR without new operators or syntax changes

Jeremy voldermort at hotmail.com
Tue May 17 07:21:28 UTC 2016


AntC wrote
> No. For TDNR GHC needs some syntactic signal to trigger disambiguation.
> ...
> I suspect that if you took the syntax away from TDNR, you'd have very
> little left.

To copy an example from the TDNR wiki page:

  module Foo where
    import Button( Button, reset ) as B
    import Canvas( Canvas, reset ) as C

    f :: Button -> Canvas -> IO ()
    f b c = do { B.reset b; C.reset c }

With syntaxless TDNR enabled, the last line could be:

    f b c = do { reset b; reset c }

This requires no syntactic signal. The compiler will see two candidate
definitions for reset, and in each case, pick the one which matches its
argument.



--
View this message in context: http://haskell.1045720.n5.nabble.com/TDNR-without-new-operators-or-syntax-changes-tp5835927p5835978.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.


More information about the Glasgow-haskell-users mailing list