From 62d12ce058f61577aeb17adc5619eef449eac79b Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 2 May 2014 15:20:24 +1000 Subject: Separated GraspProgram type and associated functions into own module --- src/Grasp/Parser.hs | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/Grasp/Parser.hs') diff --git a/src/Grasp/Parser.hs b/src/Grasp/Parser.hs index 1ddbb94..9bea358 100644 --- a/src/Grasp/Parser.hs +++ b/src/Grasp/Parser.hs @@ -1,10 +1,5 @@ module Grasp.Parser ( - GraspProgram(..), - GraspData(..), - parseGrasp, - nodesWithName, - iso, dup ) where @@ -19,12 +14,11 @@ import Data.Graph.Inductive.Graph as Graph import Data.Graph.Inductive.Tree import Data.List import Data.Maybe +import Grasp.Types -type GraspProgram = Gr String String - type StrLNode a = (String,a) type StrLEdge a = (String,String,a) @@ -33,12 +27,6 @@ type GraspData = ([StrLNode String],[StrLEdge String]) -instance (Ord a, Ord b) => Eq (Gr a b) where - a == b = ((sort . Graph.labNodes $ a) == (sort . Graph.labNodes $ b)) && - ((sort . Graph.labEdges $ a) == (sort . Graph.labEdges $ b)) - - - parseGrasp :: String -> Either ParseError GraspProgram parseGrasp input = @@ -99,28 +87,6 @@ constructGraph = uncurry Graph.mkGraph -nodesWithName :: GraspProgram -> String -> [LNode String] -nodesWithName g s = [] - - - -normalise :: GraspData -> ([LNode String],[LEdge String]) -normalise (n,e) = ([],[]) - - - -iso :: GraspProgram -> GraspProgram -> Bool -iso a b = - let f (x,y) = (show x, y) - g (x,y,z) = (show x, show y, z) - - -- converts a grasp program into grasp data - h x = ((map f) . Graph.labNodes $ x, (map g) . Graph.labEdges $ x) - - in (constructGraph . normalise . h $ a) == (constructGraph . normalise . h $ b) - - - dup :: (Eq a) => [a] -> Maybe a dup x = let dup' [] _ = Nothing -- cgit