From 40d8f23c7abd648e1e147c7457244c31dc9b20e4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 23 Aug 2011 16:28:56 -0400 Subject: [PATCH] Throw an error when comparing two RealFunctions for equality. Print RealFunctions within angled brackets, i.e. "". --- src/RealFunction.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.44.2