6 ms·
I think the approach taken by the author is simply the wrong one. Writing a huge amount of code without any clue what the types are going to be is just silly.
by chongli 10y ago
I think the approach taken by the author is simply the wrong one. Writing a huge amount of code without any clue what the types are going to be is just silly.
Haskell makes it very easy for you if you work with it in a more interactive fashion, asking it to infer types for you as you go along. One of the best features for doing this is Typed Holes [0].
[0] https://wiki.haskell.org/GHC/Typed_holes https://wiki.haskell.org/GHC/Typed_holes
- Ericson2314 10y agoYeah I always use the type checker to help me refactor too.
- mightybyte 10y agoI think in this case it's a reasonable approach to writing the `dpll` function because that function doesn't actually care about the specifics of the types. This is a nice example of encapsulation and implementation hiding, a concept familiar to object-oriented and functional programmers alike. He could have easily gotten it to compile by stubbing things out as follows: data Clauses = Clauses data Symbols = Symbols data Model = Model isTrueIn = undefined isFalseIn = undefined findPureSymbol = undefined minus = undefined including = undefined findUnitClause = undefined I think it's more a question of personal preference than right or wrong.