Permalink
Browse files

Data.HashTable testing

  • Loading branch information...
1 parent ebf86a6 commit 5d1beb0f13ef94ef308882bc022b13518b3be12f @Detegr committed Feb 25, 2014
Showing with 21 additions and 2 deletions.
  1. +20 −1 src/TapiPass.hs
  2. +1 −1 tapiPass.cabal
View
@@ -1,2 +1,21 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Main where
+
+import qualified Data.HashTable.ST.Basic as HT
+import Control.Monad.ST.Safe
+import Data.Text
+import Data.Maybe (fromMaybe)
+import qualified Data.Text.IO as TIO
+
+type TapiPassHT s = HT.HashTable s Text Text
+
+hashTest :: ST s Text
+hashTest = do
+ ht <- HT.new :: ST s (HT.HashTable s Text Text)
+ HT.insert ht "key" "val"
+ mb <- HT.lookup ht "key"
+ return $ fromMaybe "nothing" mb
+
main :: IO()
-main = putStrLn "Hello tapiPass!"
+main = TIO.putStrLn $ runST hashTest
View
@@ -20,6 +20,6 @@ executable tapiPass
main-is: src/TapiPass.hs
-- other-modules:
-- other-extensions:
- build-depends: base >=4.5 && <4.6
+ build-depends: base >=4.5 && <4.6, hashtables >= 1.1.2.1, text, transformers, hashable
-- hs-source-dirs:
default-language: Haskell2010

0 comments on commit 5d1beb0

Please sign in to comment.