1
Fork 0
satellite/dotfiles/vscode-snippets/snippets/purescript/deriving.json

78 lines
1.9 KiB
JSON
Raw Normal View History

2022-08-05 19:11:10 +02:00
{
"Derive newtype instance": {
2022-08-08 16:25:54 +02:00
"prefix": "gnderive",
2022-08-05 19:11:10 +02:00
"description": "Use newtype deriving on any typeclass",
"body": "derive newtype instance $0 $3 $2"
},
"Generate json instances": {
"prefix": "json",
"description": "Generate the deriving of the EncodeJson and DecodeJson typeclasses",
"body": [
"derive newtype instance EncodeJson $1",
"derive newtype instance DecodeJson $1"
]
},
"Generic": {
2022-08-08 16:25:54 +02:00
"prefix": "dgeneric",
2022-08-05 19:11:10 +02:00
"description": "Generate the generic instance for a type",
"body": "derive instance Generic $1 _"
},
"Generic Show": {
"prefix": "gshow",
"description": "Generate generic show instances",
"body": [
"instance Show $1 where",
" show = genericShow"
]
},
"Generic Debug": {
"prefix": "gdebug",
"description": "Generate generic debug instances",
"body": [
"instance Debug $1 where",
" debug = genericDebug"
]
},
"Generic json": {
"prefix": "gjson",
"description": "Generate generic json instances",
"body": [
"instance EncodeJson $1 where",
" encodeJson = genericEncodeJson",
"instance DecodeJson $1 where",
" decodeJson = genericDecodeJson"
]
},
"Instance": {
"prefix": "instance",
"description": "Declare typeclass instance",
"body": [
"instance $2 $3 where",
" $0"
]
},
"Functor": {
2022-08-08 16:25:54 +02:00
"prefix": "dfunctor",
2022-08-05 19:11:10 +02:00
"description": "Derive a Functor instance",
"body": "derive instance Functor $1$0"
2022-08-08 16:25:54 +02:00
},
"Eq": {
"prefix": "deq",
"description": "Derive an Eq instance",
"body": "derive instance Eq $1$0"
},
"Ord": {
"prefix": "dord",
"description": "Derive an Ord instance",
"body": "derive instance Ord $1$0"
},
"Eq & Ord": {
"prefix": "deqord",
"description": "Derive an Eq and an Ord instance",
"body": [
"derive instance Eq $1",
"derive instance Ord $1$0"
]
2022-08-05 19:11:10 +02:00
}
}