44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
# key: thenewtype
|
|
# name: new purescript newtype in its' own module
|
|
# --
|
|
# in 'text-mode' because purescript-mode generates parse error
|
|
module ${1:ModulePrefix}.${2:NewTypeName} (
|
|
$2(..)
|
|
, aDummy
|
|
) where
|
|
|
|
import Data.Firebase.Foreign (class ToFirebaseForeign)
|
|
import Data.Foreign (toForeign, readString)
|
|
import Data.Foreign.Class (class IsForeign)
|
|
import Data.Generic (class Generic, gCompare, gEq, gShow)
|
|
import Test.QuickCheck.Arbitrary (class Arbitrary, arbitrary)
|
|
import Prelude (class Eq, class Ord, class Show, ($),bind, pure)
|
|
import UReview.Prelude (readForeign)
|
|
|
|
newtype $2 = $2 {${4:fieldName}:: ${5:Type}}
|
|
|
|
aDummy :: $2
|
|
aDummy = $2 {$4: "$6"}
|
|
derive instance generic$2 :: Generic $2
|
|
|
|
instance show$2 :: Show $2 where
|
|
show = gShow
|
|
|
|
instance eq$2 :: Eq $2 where
|
|
eq = gEq
|
|
|
|
instance ord$2 :: Ord $2 where
|
|
compare = gCompare
|
|
|
|
instance arb$2 :: Arbitrary $2 where
|
|
arbitrary = do
|
|
$4 <- arbitrary
|
|
pure ($2 {$4 })
|
|
|
|
instance isForeign$2 :: IsForeign $2 where
|
|
read fo = readForeign fo
|
|
|
|
instance toFirebaseForeign$2 :: ToFirebaseForeign $2
|
|
where toFire = ${7:conversionFn} >>> toForeign
|
|
|
|
$0 |