[commit: nofib] master: spectral: revive last-piece (070e016)
git at git.haskell.org
git at git.haskell.org
Sat Feb 18 05:10:18 UTC 2017
Repository : ssh://git@git.haskell.org/nofib
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/070e01659b533dad8f3379f31813d4f3b1bf2c71/nofib
>---------------------------------------------------------------
commit 070e01659b533dad8f3379f31813d4f3b1bf2c71
Author: Michal Terepeta <michal.terepeta at gmail.com>
Date: Tue Feb 14 17:00:06 2017 -0500
spectral: revive last-piece
Summary:
I'm not entirely sure if the benchmark is worth reviving, but
it was quite easy and we can always remove it later.
This also removed the unused PROG_ARGS from the Makefile.
Signed-off-by: Michal Terepeta <michal.terepeta at gmail.com>
Test Plan: compile & run
Reviewers: bgamari
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D3042
>---------------------------------------------------------------
070e01659b533dad8f3379f31813d4f3b1bf2c71
spectral/Makefile | 6 +++---
spectral/last-piece/Main.hs | 14 +++++++-------
spectral/last-piece/Makefile | 6 +-----
3 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/spectral/Makefile b/spectral/Makefile
index 4b1ee52..27d3d60 100644
--- a/spectral/Makefile
+++ b/spectral/Makefile
@@ -3,13 +3,13 @@ include $(TOP)/mk/boilerplate.mk
SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \
clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \
- fft2 fibheaps fish gcd hartel integer knights lcss life mandel \
- mandel2 minimax multiplier para power pretty primetest puzzle \
+ fft2 fibheaps fish gcd hartel integer knights last-piece lcss life \
+ mandel mandel2 minimax multiplier para power pretty primetest puzzle \
rewrite scc simple sorting sphere treejoin
# compreals no suitable test data
# salishan no Haskell code!
-OTHER_SUBDIRS = compreals lambda last-piece mate salishan secretary triangle
+OTHER_SUBDIRS = compreals lambda mate salishan secretary triangle
include $(TOP)/mk/target.mk
diff --git a/spectral/last-piece/Main.hs b/spectral/last-piece/Main.hs
index d2251bd..41552c4 100644
--- a/spectral/last-piece/Main.hs
+++ b/spectral/last-piece/Main.hs
@@ -4,9 +4,9 @@
module Main where
import Prelude hiding( flip )
-import Pretty
import Data.Maybe
-import FiniteMap
+import Text.PrettyPrint
+import qualified Data.Map as Map
----------------------------
-- Driver
@@ -119,19 +119,19 @@ check :: Board -> Square -> Maybe PieceId
extend :: Board -> Square -> PieceId -> Board
extend_maybe :: Board -> Square -> PieceId -> Maybe Board
-type Board = FiniteMap Square PieceId
+type Board = Map.Map Square PieceId
-emptyBoard = emptyFM
+emptyBoard = Map.empty
-check bd sq = lookupFM bd sq
+check bd sq = Map.lookup sq bd
-extend bd sq id = addToFM bd sq id
+extend bd sq id = Map.insert sq id bd
extend_maybe bd sq@(row,col) id
| row > maxRow || col < 1 || col > maxCol
= Nothing
| otherwise
- = case lookupFM bd sq of
+ = case check bd sq of
Just _ -> Nothing
Nothing -> Just (extend bd sq id)
diff --git a/spectral/last-piece/Makefile b/spectral/last-piece/Makefile
index 5316d0e..94ab9a3 100644
--- a/spectral/last-piece/Makefile
+++ b/spectral/last-piece/Makefile
@@ -1,11 +1,7 @@
TOP = ../..
include $(TOP)/mk/boilerplate.mk
-SRC_HC_OPTS += -package text -package data
-
-
-# Arguments for the test program
-PROG_ARGS = 8 3
+SRC_HC_OPTS += -package containers -package pretty
include $(TOP)/mk/target.mk
More information about the ghc-commits
mailing list