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
21import Data.Function (on)
24-- Names for value identifiers
28 -- An alphanumeric identifier
32 -- A symbolic name for an infix operator
38 | Escaped String deriving (Data, Typeable)
40instance Show Ident where
42 show (Op op) = '(':op ++ ")"
45instance Eq Ident where
46 Ident s1 == Ident s2 = s1 == s2
47 Op s1 == Op s2 = s1 == s2
48 Escaped s1 == Escaped s2 = s1 == s2
49 Ident s1 == Escaped s2 = s1 == s2
50 Escaped s1 == Ident s2 = s1 == s2
53instance Ord Ident where
54 compare = compare `on` show
57-- Proper names, i.e. capitalized names for e.g. module names, type//data constructors.
59newtype ProperName = ProperName { runProperName :: String } deriving (Eq, Ord, Data, Typeable)
61instance Show ProperName where
67data ModuleName = ModuleName { runModuleName :: ProperName } deriving (Eq, Ord, Data, Typeable)
69instance Show ModuleName where
70 show (ModuleName name) = show name
73-- A qualified name, i.e. a name with an optional module name
75data Qualified a = Qualified (Maybe ModuleName) a deriving (Eq, Ord, Data, Typeable)
77instance (Show a) => Show (Qualified a) where
78 show (Qualified Nothing a) = show a
79 show (Qualified (Just (ModuleName name)) a) = show name ++ "." ++ show a
82-- Provide a default module name, if a name is unqualified
84qualify :: ModuleName -> Qualified a -> (ModuleName, a)
85qualify m (Qualified Nothing a) = (m, a)
86qualify _ (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