[Haskell-cafe] model theory for type classes
byorgey at seas.upenn.edu
Thu Aug 23 17:02:17 CEST 2012
On Thu, Aug 23, 2012 at 01:25:39PM +0100, Patrick Browne wrote:
> If there is no model expansion could it be because of the constructor
> discipline, which only allows variables, and constructors in the LHS
> argument patterns.
Indeed, a variable name as a pattern on the LHS of a function
definition has nothing to do with any names which might be in scope.
It is simply a pattern which matches anything. I am not sure what (if
anything) this says about model expansions.
> constant = (1::Int)
> fun1::Int -> Int
> fun1 (constant::Int) = 8
fun1 returns 8 for all inputs. The fact that fun1's definition uses
the name 'constant' which happens to have the same name as something
in scope is irrelevant. For example, this is precisely the same as the above:
constant :: Int
constant = 1
fun1 :: Int -> Int
fun1 foo = 8
More information about the Haskell-Cafe