Skip to content

Commit

Permalink
Refactor: reduce some usage of '#if IS_WINDOWS'
Browse files Browse the repository at this point in the history
  • Loading branch information
dfordivam committed Dec 2, 2024
1 parent c8df1a8 commit a18a9cd
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions lib-tui/GHCup/Brick/Common.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -53,6 +52,7 @@ module GHCup.Brick.Common (
) ) where

import GHCup.List ( ListResult )
import GHCup.Prelude ( isWindows )
import GHCup.Types ( Tool, KeyCombination (KeyCombination) )
import Data.List (intercalate)
import Prelude hiding ( appendFile )
Expand Down Expand Up @@ -161,32 +161,20 @@ data Mode = Navigation
deriving (Eq, Show, Ord)

installedSign :: String
#if IS_WINDOWS
installedSign = "I "
#else
installedSign = ""
#endif
| isWindows = "I "
| otherwise = ""

setSign :: String
#if IS_WINDOWS
setSign = "IS"
#else
setSign = "✔✔"
#endif
| isWindows = "IS"
| otherwise = "✔✔"

notInstalledSign :: String
#if IS_WINDOWS
notInstalledSign = "X "
#else
notInstalledSign = ""
#endif
| isWindows = "X "
| otherwise = ""

checkBoxSelectedSign :: String
#if IS_WINDOWS
checkBoxSelectedSign = "Y "
#else
checkBoxSelectedSign = ""
#endif
| isWindows = "Y "
| otherwise = ""


showKey :: Vty.Key -> String
Expand Down

0 comments on commit a18a9cd

Please sign in to comment.