Advertisement
Guest User

Untitled

a guest
Jan 8th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --This is part of the setup and should not be changed
  2. -- D and T are type synonyms for Bytestring and I is  a type Synonym for Word
  3. data TItem = TItem
  4.   { tiI :: !I
  5.   , tiD :: !D
  6.   , tiT :: ![T]
  7.   } deriving (Show, Eq, Ord)
  8.  
  9. class MTL m where
  10.   add    :: D -> [T] -> m I
  11. --
  12.  
  13. data TL = TL {
  14.                 list    :: [TIitem]
  15.         }
  16.   deriving (Show, Eq)
  17.  
  18. emptyTList :: TL
  19. emptyTList = TL []
  20.  
  21.  
  22. -- This is part of the setup and should not be changed
  23. newtype TLM a = TLM { runTLM :: StateT TL IO a }
  24.   deriving (Functor, Applicative, Monad, MonadIO)
  25. --
  26.  
  27. instance MTL TLM where
  28.   --add :: D -> [T] -> StateT TL IO I  --Filled in TLM to get this type but that might be the problem I'm having
  29.   add desc tags = do
  30.                 i <- gets nextIndex
  31.                 putStrLn (show i)
  32.                 return i
  33.                 where   nextIndex (TL []) = 0
  34.                         nextIndex (TL (x:_)) = (tiI x) + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement