<commit_before>{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad.IO.Class
import Control.Monad.Trans (lift)
import Control.Monad (when)
import qualified Data.Text as T
import Menu
import Data.List ((\\))
import Data.Default (def)

import IO
import FitState

import System.Console.Haskeline (MonadException, InputT, runInputT, defaultSettings)
import Data.Time (Day)

data MainMenuCommand = MMWorkoutMode | MMWorkoutStatus | MMAdjustWorkoutReps | MMUpdate | MMInclude | MMDisInclude | MMAdd | MMRemove deriving (Eq, Ord)


main :: IO ()
main = do
  runInputT defaultSettings (runFitStateT mainLoop)


mainLoop :: (MonadException m) => FitStateT (InputT m) ()
mainLoop = do
  command <- liftIO $ inputMenu (def { quitOption = True }) "Main Menu" menuCrud

  case command of
    MenuError -> mainLoop
    MenuQuit -> return ()
    MenuInput command' -> do
      case command' of
        MMWorkoutMode       -> workoutMode
        MMWorkoutStatus     -> printWorkout id
        MMAdjustWorkoutReps -> adjustWorkoutByReps
        MMInclude           -> addExerciseToWorkout<commit_msg>Turns out my buffering strategies are still important.<commit_after>{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad.IO.Class
import Control.Monad.Trans (lift)
import Control.Monad (when)
import qualified Data.Text as T
import Menu
import Data.List ((\\))
import Data.Default (def)

import IO
import FitState

import System.Console.Haskeline (MonadException, InputT, runInputT, defaultSettings)
import Data.Time (Day)

import System.IO (stdout, stdin, hSetBuffering, BufferMode(..))


data MainMenuCommand = MMWorkoutMode | MMWorkoutStatus | MMAdjustWorkoutReps | MMUpdate | MMInclude | MMDisInclude | MMAdd | MMRemove deriving (Eq, Ord)


main :: IO ()
main = do
  hSetBuffering stdin NoBuffering
  hSetBuffering stdout LineBuffering
  runInputT defaultSettings (runFitStateT mainLoop)


mainLoop :: (MonadException m) => FitStateT (InputT m) ()
mainLoop = do
  command <- liftIO $ inputMenu (def { quitOption = True }) "Main Menu" menuCrud

  case command of
    MenuError -> mainLoop
    MenuQuit -> return ()
    MenuInput command' -> do
      case command' of
        MMWorkoutMode       -> workoutMode
        MMWorkoutStatus     -> printWorkout id
        MMAdjustWorkoutReps -> adjustWorkoutByReps
        MMInclude           -> addExerciseToWorkout
{'fraction_non_alphanumeric': 0.08577405857740586, 'fraction_numerical': 0.0, 'mean_word_length': 3.725296442687747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '37812', 'n_tokens_mistral': 757, 'n_tokens_neox': 719, 'n_words': 216}