From: Michael Orlitzky Date: Tue, 23 Aug 2011 20:28:56 +0000 (-0400) Subject: Throw an error when comparing two RealFunctions for equality. X-Git-Tag: 0.0.1~227 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=spline3.git;a=commitdiff_plain;h=40d8f23c7abd648e1e147c7457244c31dc9b20e4 Throw an error when comparing two RealFunctions for equality. Print RealFunctions within angled brackets, i.e. "". --- diff --git a/src/RealFunction.hs b/src/RealFunction.hs index 6a557a9..14afb91 100644 --- a/src/RealFunction.hs +++ b/src/RealFunction.hs @@ -11,13 +11,13 @@ type RealFunction a = (a -> Double) instance Show (RealFunction a) where -- | There is nothing of value that we can display about a -- function, so simply print its type. - show _ = "RealFunction" + show _ = "" -- | An 'Eq' instance is required to be a 'Num' instance. instance Eq (RealFunction a) where -- | Nothing else makes sense here; always return 'False'. - _ == _ = False + _ == _ = error "You can't compare functions for equality." -- | The 'Num' instance for RealFunction allows us to perform