Skip to content

Commit

Permalink
Merge pull request #4 from buzden/adopt-1926
Browse files Browse the repository at this point in the history
[ upstream ] Adopt to changes of `Name` type from idris-lang/Idris2#1926
  • Loading branch information
stefan-hoeck authored Sep 16, 2021
2 parents f71ee3a + 652c245 commit b2e0d9f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Generics/Derive.idr
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ int = primVal . I
-- to a function (`con`) wrapped in a `TTImp`.
private
appNSName : Name -> (con : TTImp) -> TTImp
appNSName (NS (MkNS ss) (UN s)) con = let ss' = listOf $ reverse $ map str ss
in con .$ ss' .$ str s
appNSName n con = let s = str $ nameStr n
in `(~(con) []) .$ s
appNSName (NS (MkNS ss) (UN $ Basic s)) con = let ss' = listOf $ reverse $ map str ss
in con .$ ss' .$ str s
appNSName n con = let s = str $ nameStr n
in `(~(con) []) .$ s

-- creates an ArgName's TTImp from an argument's index and name
private
argNameTTImp : (Int,Name) -> TTImp
argNameTTImp (k, UN n) = `(NamedArg) .$ int k .$ str n
argNameTTImp (k, _) = `(UnnamedArg) .$ int k
argNameTTImp (k, UN $ Basic n) = `(NamedArg) .$ int k .$ str n
argNameTTImp (k, _) = `(UnnamedArg) .$ int k

-- creates a ConInfo's TTImp from a `ParamCon`.
private
Expand Down Expand Up @@ -321,6 +321,8 @@ Show = ShowVis Public

%runElab derive "Namespace" [Generic,Meta,Eq,Ord]

%runElab derive "UserName" [Generic,Meta,Eq,Ord]

%runElab derive "Name" [Generic,Meta,Eq,Ord]

%runElab derive "Count" [Generic,Meta,Show,Eq,Ord]
Expand Down

0 comments on commit b2e0d9f

Please sign in to comment.