X-Git-Url: https://mattmccutchen.net/match/match.git/blobdiff_plain/578d7d9809c18a096bb1c9a31125abccb79be782..e5c5cbd9d48ecf8de5e7b0c20d7164b4b7bf340b:/program/Main.hs diff --git a/program/Main.hs b/program/Main.hs index 0bbfdda..92c91fc 100644 --- a/program/Main.hs +++ b/program/Main.hs @@ -5,20 +5,15 @@ import System.IO import Data.Array.IArray import Data.Array.Unboxed import ArrayStuff -import Text.CSV +import TSV --- pretty silly but it does the job -swapTabCommaIn s = map (\c -> if c == '\t' then ',' else if c == ',' then '\t' else c) s -removeQuotes s = filter (\c -> not (c == '"')) s -parseTSV fname str = case parseCSV fname (swapTabCommaIn str) of - Left pe -> Left pe - Right ll -> Right $ map (map swapTabCommaIn) ll -printTSV ll = removeQuotes $ swapTabCommaIn $ printCSV $ map (map swapTabCommaIn) ll +-- Command-line interface with simple tab-separated input/output formats. +-- ./match read $ pxarr ! (2*j, 0)) let theInst = PMInstance numRvrs numProps loadA prefA expA fixA pnrA let PMatching theMatching = doMatching pmDefaults theInst - hPutStr stdout $ printTSV $ map (\(i, j) -> map show [i, j]) theMatching + hPutStr stdout $ formatTSV $ map (\(i, j) -> map show [i, j]) theMatching