1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Names
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15{-# LANGUAGE DeriveDataTypeable #-}
17module Language.PureScript.Names where
20import Data.List (inits, intercalate)
22data Ident = Ident String | Op String deriving (Eq, Ord, Data, Typeable)
24instance Show Ident where
26 show (Op op) = '(':op ++ ")"
28newtype ProperName = ProperName { runProperName :: String } deriving (Eq, Ord, Data, Typeable)
30instance Show ProperName where
33data ModulePath = ModulePath [ProperName] deriving (Eq, Ord, Data, Typeable)
35instance Show ModulePath where
36 show (ModulePath segments) = intercalate "." $ map show segments
38subModule :: ModulePath -> ProperName -> ModulePath
39subModule (ModulePath mp) name = ModulePath (mp ++ [name])
44data Qualified a = Qualified ModulePath a deriving (Eq, Ord, Data, Typeable)
46instance (Show a) => Show (Qualified a) where
47 show (Qualified (ModulePath names) a) = intercalate "." (map show names ++ [show a])
49qualify :: ModulePath -> Qualified a -> (ModulePath, a)
50qualify mp (Qualified (ModulePath []) a) = (mp, a)
51qualify _ (Qualified mp a) = (mp, a)
53nameResolution :: ModulePath -> Qualified a -> [(ModulePath, a)]
54nameResolution (ModulePath mp) (Qualified (ModulePath []) a) = [ (ModulePath mp', a) | mp' <- reverse $ inits mp ]
55nameResolution _ (Qualified mp a) = [(mp, a)]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list