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 Nov 19, 2024
1 parent 71f5738 commit 7266dcb
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 @@ -160,32 +160,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 7266dcb

Please sign in to comment.