1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Names
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
12-- Data types for names
14-----------------------------------------------------------------------------
16{-# LANGUAGE DeriveDataTypeable #-}
18module Language.PureScript.Names where
24-- Names for value identifiers
28 -- An alphanumeric identifier
32 -- A symbolic name for an infix operator
34 | Op String deriving (Eq, Ord, Data, Typeable)
36instance Show Ident where
38 show (Op op) = '(':op ++ ")"
41-- Proper names, i.e. capitalized names for e.g. module names, type//data constructors.
43newtype ProperName = ProperName { runProperName :: String } deriving (Eq, Ord, Data, Typeable)
45instance Show ProperName where
51data ModuleName = ModuleName [ProperName] deriving (Eq, Ord, Data, Typeable)
53runModuleName :: ModuleName -> String
54runModuleName (ModuleName pns) = intercalate "." (runProperName `map` pns)
56moduleNameFromString :: String -> ModuleName
57moduleNameFromString = ModuleName . splitProperNames
59 splitProperNames s = case dropWhile (== '.') s of
61 s' -> ProperName w : splitProperNames s''
62 where (w, s'') = break (== '.') s'
64instance Show ModuleName where
68-- A qualified name, i.e. a name with an optional module name
70data Qualified a = Qualified (Maybe ModuleName) a deriving (Eq, Ord, Data, Typeable)
72instance (Show a) => Show (Qualified a) where
73 show (Qualified Nothing a) = show a
74 show (Qualified (Just name) a) = show name ++ "." ++ show a
77-- Provide a default module name, if a name is unqualified
79qualify :: ModuleName -> Qualified a -> (ModuleName, a)
80qualify m (Qualified Nothing a) = (m, a)
81qualify _ (Qualified (Just m) a) = (m, 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