Skip to content

Instantly share code, notes, and snippets.

View Lev135's full-sized avatar
📚
Studying mathematics

Lev Dvorkin Lev135

📚
Studying mathematics
  • 22:01 (UTC +03:00)
View GitHub Profile
@orclev
orclev / trie.hs
Created February 28, 2012 04:23
Haskell trie implementation
import Data.Maybe
import Control.Monad (liftM)
import Data.List (isPrefixOf)
import qualified Data.Map as M
import qualified Data.Foldable as F
-- | Trie container data type
data Trie a = Trie { value :: Maybe a
, children :: M.Map Char (Trie a) }
deriving (Show)