Skip to content

Commit

Permalink
switch from symbol to intern as the former seems dormant
Browse files Browse the repository at this point in the history
`intern` seems to serve the same purpose but is actively maintained by
Ryan G. Scott and a part of kmettoverse

this hopefully unlocks support for GHC 9.10
  • Loading branch information
ulysses4ever committed Jun 14, 2024
1 parent d59464d commit 017d74d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gibbon-compiler/gibbon.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ library
, hse-cpp >= 0.1 && < 1
, s-cargot >= 0.1.3 && < 1
, srcloc >= 0.6 && < 1
, symbol >= 0.2.4 && < 1
, intern ^>= 0.9
-- Pretty printers:
, pretty >= 1.1.1.3 && < 1.2
, GenericPretty >= 1.2.1 && < 2
Expand Down
16 changes: 15 additions & 1 deletion gibbon-compiler/src/Gibbon/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Gibbon.Common
-- * Variables
Var(..), LocVar, RegVar, fromVar, toVar, varAppend, toEndV, toSeqV, cleanFunName
, TyVar(..), isUserTv
, Symbol, intern, unintern

-- * Gensym monad
, SyM, gensym, gensym_tag, genLetter, newUniq, runSyM
Expand Down Expand Up @@ -49,7 +50,8 @@ import Data.Char
import qualified Data.List as L
import Data.Map as M
import Data.String
import Data.Symbol
import qualified Data.Interned as DI
import Data.Interned.String
import Data.Word
import GHC.Generics
import GHC.Stack (HasCallStack)
Expand All @@ -67,6 +69,18 @@ import Gibbon.DynFlags

--------------------------------------------------------------------------------

newtype Symbol = Symbol InternedString
deriving (Eq, Ord, Show)

instance (Read Symbol) where
readsPrec _ s = [(Symbol $ DI.intern s, "")]

intern :: String -> Symbol
intern = Symbol . DI.intern

unintern :: Symbol -> String
unintern (Symbol is) = DI.unintern is

-- type CursorVar = Var
newtype Var = Var Symbol
deriving (Eq, Ord, Read, Show)
Expand Down
1 change: 0 additions & 1 deletion gibbon-compiler/src/Gibbon/L0/ElimNewtype.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Gibbon.Common
import Control.Arrow
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Symbol ( unintern )

elimNewtypes :: Monad m => Prog0 -> m Prog0
elimNewtypes = pure . elimProgram
Expand Down
1 change: 0 additions & 1 deletion gibbon-compiler/src/Gibbon/L1/GenSML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Control.Monad
import Data.Map hiding (foldr, fold, null, empty)
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Symbol

import Data.Foldable hiding ( toList )
import Data.Graph
Expand Down
1 change: 0 additions & 1 deletion gibbon-compiler/src/Gibbon/Passes/Fusion2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import qualified Data.Map as M
import qualified Data.List as L
import qualified Data.Set as S
import qualified Data.Vector as V
import Data.Symbol
import Data.Char ( toLower )
import Debug.Trace
import Control.DeepSeq
Expand Down

0 comments on commit 017d74d

Please sign in to comment.