clanki 1.2.1 → 1.2.2
raw patch · 3 files changed
+10/−5 lines, 3 files
Files
- clanki.cabal +1/−1
- src/Main.hs +4/−1
- src/Quiz.hs +5/−3
clanki.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: clanki-version: 1.2.1+version: 1.2.2 synopsis: Command-line spaced-repetition software description: Command-line spaced-repetition learning software. CL (command line) + Anki (popular spaced-repetition software) = Clanki. Usage is fairly simple, just follow the instructions after running the program. Add a deck, add cards to the deck, then quiz whenever possible. The program will determine what cards need to be reviewed, using the Super Memo 2 algorithm. license: MIT
src/Main.hs view
@@ -13,7 +13,6 @@ import Safe(readMay) import Control.Monad(filterM) import qualified System.IO.Strict as SIO-import qualified Data.ByteString as Str data Action = Quiz | Add | Remove | Show | Quit deriving (Show, Eq, Ord, Enum) @@ -28,7 +27,9 @@ runAction :: Maybe Action -> [Card] -> IO () runAction (Just Quit) cards = do+ printf "before \n" saveData cards+ printf "after \n" return () runAction (Just Add) cards = addLoop cards >>= mainLoop runAction (Just Quiz) cards = quizLoop cards >>= mainLoop@@ -85,7 +86,9 @@ | firstOptionIsDeck = if secondOptionIsNum then do+ printf "Before thing \n" let numOfCardsToQuiz = read $ args !! 1+ printf "After thing \n" let deckCards = cardsInDeck (head args) cards cardsToQuiz <- filterM shouldQuizCard (take numOfCardsToQuiz deckCards) quizSomeCards cardsToQuiz cards
src/Quiz.hs view
@@ -77,7 +77,7 @@ quizCard :: Card -> IO (Maybe Card) quizCard card = do printf $ "Question : " ++ cardQuestion card ++ "\n"- printf "Answer : "+ printf $ "Answer : " hFlush stdout answer <- getLine confidence <- getConfidence answer (cardAnswer card)@@ -129,9 +129,11 @@ Nothing -> return Nothing quizFromDeck :: String -> [Card] -> IO [Card]-quizFromDeck deckName cards = quizSomeCards deckCards cards+quizFromDeck deckName cards = do+ cardsToBeQuizzed <- cardsToQuiz deckCards+ quizSomeCards cardsToBeQuizzed cards where- deckCards = filter (\card -> cardDeck card == deckName) cards+ deckCards = cardsInDeck deckName cards getQuizAction :: [Card] -> IO (Maybe QuizAction) getQuizAction [] = do