From 545c52c4fbec2b187d60cfcb492e1937eea76722 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Tue, 6 Mar 2018 23:55:13 -0600 Subject: [PATCH 1/2] Explaining the custom Eq, Ord instances for Binder --- src/Language/PureScript/AST/Binders.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Language/PureScript/AST/Binders.hs b/src/Language/PureScript/AST/Binders.hs index c27105c534..01534c2978 100644 --- a/src/Language/PureScript/AST/Binders.hs +++ b/src/Language/PureScript/AST/Binders.hs @@ -65,6 +65,16 @@ data Binder | TypedBinder Type Binder deriving (Show) +-- Manual Eq and Ord instances for Binder were added +-- on 2018-03-05. Comparing the `SourceSpan` values +-- embedded in some of the data constructors of `Binder` +-- was expensive. This made exhaustiveness checking +-- obserably slow for code such as the `explode` function +-- in `examples/passing/LargeSumTypes.purs`. Custom +-- instances were written to skip comparing the +-- `SourceSpan` values. Only the `Ord` instance was +-- needed for the speed-up, but I did not want the +-- `Eq` to have mismatched behavior. instance Eq Binder where (==) NullBinder NullBinder = True (==) NullBinder _ = False From 194e1b38160aa4df7f948c6cf4139f3a958728d3 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 9 Mar 2018 05:38:47 +0100 Subject: [PATCH 2/2] fix type and stretch to 80 characters --- src/Language/PureScript/AST/Binders.hs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Language/PureScript/AST/Binders.hs b/src/Language/PureScript/AST/Binders.hs index 01534c2978..e7bbd29fbb 100644 --- a/src/Language/PureScript/AST/Binders.hs +++ b/src/Language/PureScript/AST/Binders.hs @@ -65,16 +65,13 @@ data Binder | TypedBinder Type Binder deriving (Show) --- Manual Eq and Ord instances for Binder were added --- on 2018-03-05. Comparing the `SourceSpan` values --- embedded in some of the data constructors of `Binder` --- was expensive. This made exhaustiveness checking --- obserably slow for code such as the `explode` function --- in `examples/passing/LargeSumTypes.purs`. Custom --- instances were written to skip comparing the --- `SourceSpan` values. Only the `Ord` instance was --- needed for the speed-up, but I did not want the --- `Eq` to have mismatched behavior. +-- Manual Eq and Ord instances for `Binder` were added on 2018-03-05. Comparing +-- the `SourceSpan` values embedded in some of the data constructors of `Binder` +-- was expensive. This made exhaustiveness checking observably slow for code +-- such as the `explode` function in `examples/passing/LargeSumTypes.purs`. +-- Custom instances were written to skip comparing the `SourceSpan` values. Only +-- the `Ord` instance was needed for the speed-up, but I did not want the `Eq` +-- to have mismatched behavior. instance Eq Binder where (==) NullBinder NullBinder = True (==) NullBinder _ = False