packages feed

sloane 1.4 → 1.5

raw patch · 3 files changed

+9/−11 lines, 3 files

Files

README.md view
@@ -1,5 +1,5 @@ ----title: SLOANE(1) Sloane User Manual | Version 1.4+title: SLOANE(1) Sloane User Manual | Version 1.5 date: March 9, 2014 --- 
sloane.cabal view
@@ -1,5 +1,5 @@ Name:                sloane-Version:             1.4+Version:             1.5 Synopsis:            A command line interface to Sloane's On-Line Encyclopedia of Integer Sequences Description:         A command line interface to Sloane's On-Line Encyclopedia of Integer Sequences.                      For usage see <http://github.com/akc/sloane>.
sloane.hs view
@@ -39,7 +39,7 @@   , limit = 5 &= name "n" &= help "Retrieve at most this many entries (default: 5)"   , terms = def &= argPos 0 &= typ "SEARCH-TERMS"   }-  &= versionArg [summary "sloane 1.4"]+  &= versionArg [summary "sloane 1.5"]   &= summary "Search Sloane's On-Line Encyclopedia of Integer Sequences"  select :: Keys -> OEISEntries -> OEISEntries@@ -67,11 +67,10 @@     | otherwise          = take (maxLen-2) s ++ ".."  getWidth :: IO Int-getWidth = do-    win <- size-    case win of-        Nothing  -> error "Can't get width of terminal"-        Just win -> return $ width win+getWidth = f `fmap` size+  where+    f Nothing    = maxBound+    f (Just win) = width win  put = putStr . pack putLn = putStrLn . pack@@ -92,6 +91,7 @@  main = do     args  <- cmdArgsRun sloane+    ncols <- getWidth     let pick = if all args then id else select (keys args)     let query = filter (`notElem` "[{}]") $ terms args     hits <- searchOEIS (limit args) query@@ -99,7 +99,5 @@         newline         if url args             then put (urls hits)-            else do-                ncols <- getWidth-                putEntries (ncols - 10) (pick hits)+            else putEntries (ncols - 10) (pick hits)         newline