@@ -4,6 +4,7 @@ module Elm.Compiler.Module
44 , nameToString, nameFromString
55 , hyphenate, dehyphenate
66 , defaultImports
7+ , interfacePorts
78 )
89 where
910
@@ -21,6 +22,7 @@ import qualified Transform.AddDefaultImports as Defaults
2122
2223type Interface = Module.Interface
2324
25+
2426newtype Name = Name [String]
2527 deriving (Eq, Ord)
2628
@@ -30,6 +32,13 @@ defaultImports =
3032 map Name (Map.keys Defaults.defaultImports)
3133
3234
35+interfacePorts :: Interface -> [String]
36+interfacePorts interface =
37+ Module.iPorts interface
38+
39+
40+-- STRING CONVERSIONS
41+
3342nameToPath :: Name -> FilePath
3443nameToPath (Name names) =
3544 List.foldl1 (</>) names
@@ -74,6 +83,8 @@ fromString sep raw =
7483 Char.isAlphaNum char || char `elem` "_'"
7584
7685
86+-- JSON CONVERSIONS
87+
7788instance Json.ToJSON Name where
7889 toJSON name =
7990 Json.toJSON (nameToString name)