-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from GoNZooo/r.add-basic-haskell-tests
fix(hs): fix bug in number literal output
- Loading branch information
Showing
15 changed files
with
322 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Changelog | ||
|
||
## 2.2.2 | ||
|
||
### Fixes | ||
|
||
- Fixed bug in Haskell number literal output | ||
|
||
## 2.2.1 | ||
|
||
### Fixes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module GotynoOutput.BasicEnumeration where | ||
|
||
import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
import qualified Data.Aeson as JSON | ||
import GHC.Generics (Generic) | ||
import qualified Gotyno.Helpers as Helpers | ||
import Qtility | ||
|
||
data StringValues | ||
= StringValuesFirst | ||
| StringValuesSecond | ||
| StringValuesThird | ||
| StringValuesFourth | ||
deriving (Eq, Show, Generic) | ||
|
||
instance ToJSON StringValues where | ||
toJSON StringValuesFirst = String "first" | ||
toJSON StringValuesSecond = String "second" | ||
toJSON StringValuesThird = String "Third" | ||
toJSON StringValuesFourth = String "Fourth" | ||
|
||
instance FromJSON StringValues where | ||
parseJSON = Helpers.enumFromJSON [(String "first", StringValuesFirst), (String "second", StringValuesSecond), (String "Third", StringValuesThird), (String "Fourth", StringValuesFourth)] | ||
|
||
data IntValues | ||
= IntValuesFirst | ||
| IntValuesSecond | ||
| IntValuesThird | ||
| IntValuesFourth | ||
deriving (Eq, Show, Generic) | ||
|
||
instance ToJSON IntValues where | ||
toJSON IntValuesFirst = Number $ fromInteger 1 | ||
toJSON IntValuesSecond = Number $ fromInteger 2 | ||
toJSON IntValuesThird = Number $ fromInteger 3 | ||
toJSON IntValuesFourth = Number $ fromInteger 4 | ||
|
||
instance FromJSON IntValues where | ||
parseJSON = Helpers.enumFromJSON [(Number $ fromInteger 1, IntValuesFirst), (Number $ fromInteger 2, IntValuesSecond), (Number $ fromInteger 3, IntValuesThird), (Number $ fromInteger 4, IntValuesFourth)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module GotynoOutput.BasicImport where | ||
|
||
import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
import qualified Data.Aeson as JSON | ||
import GHC.Generics (Generic) | ||
import qualified Gotyno.Helpers as Helpers | ||
import Qtility | ||
|
||
import qualified GotynoOutput.BasicStruct as BasicStruct | ||
|
||
data StructUsingImport = StructUsingImport | ||
{ _structUsingImportField :: BasicStruct.BasicStruct | ||
} | ||
deriving (Eq, Show, Generic) | ||
|
||
deriveLensAndJSON ''StructUsingImport | ||
|
||
data UnionUsingImport | ||
= ConstructorWithPayload BasicStruct.BasicStruct | ||
deriving (Eq, Show, Generic) | ||
|
||
instance ToJSON UnionUsingImport where | ||
toJSON = JSON.genericToJSON $ Helpers.gotynoOptions "type" | ||
|
||
instance FromJSON UnionUsingImport where | ||
parseJSON = JSON.genericParseJSON $ Helpers.gotynoOptions "type" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module GotynoOutput.BasicOptional where | ||
|
||
import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
import qualified Data.Aeson as JSON | ||
import GHC.Generics (Generic) | ||
import qualified Gotyno.Helpers as Helpers | ||
import Qtility | ||
|
||
data HasOptionalString = HasOptionalString | ||
{ _hasOptionalStringStringField :: (Maybe Text), | ||
_hasOptionalStringOptionalArrayField :: (Maybe [Int]), | ||
_hasOptionalStringArrayOfOptionalField :: [(Maybe Int)] | ||
} | ||
deriving (Eq, Show, Generic) | ||
|
||
deriveLensAndJSON ''HasOptionalString | ||
|
||
data HasOptionalConstructor | ||
= DoesNot Int | ||
| Does (Maybe Int) | ||
| HasOptionalStruct (Maybe HasOptionalString) | ||
deriving (Eq, Show, Generic) | ||
|
||
instance ToJSON HasOptionalConstructor where | ||
toJSON = JSON.genericToJSON $ Helpers.gotynoOptions "type" | ||
|
||
instance FromJSON HasOptionalConstructor where | ||
parseJSON = JSON.genericParseJSON $ Helpers.gotynoOptions "type" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module GotynoOutput.BasicStruct where | ||
|
||
import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
import qualified Data.Aeson as JSON | ||
import GHC.Generics (Generic) | ||
import qualified Gotyno.Helpers as Helpers | ||
import Qtility | ||
|
||
data BasicStruct = BasicStruct | ||
{ _basicStructField1 :: Int, | ||
_basicStructField2 :: Text | ||
} | ||
deriving (Eq, Show, Generic) | ||
|
||
deriveLensAndJSON ''BasicStruct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module GotynoOutput.BasicUnion where | ||
|
||
import Data.Aeson (FromJSON (..), ToJSON (..)) | ||
import qualified Data.Aeson as JSON | ||
import GHC.Generics (Generic) | ||
import qualified Gotyno.Helpers as Helpers | ||
import Qtility | ||
|
||
data PayloadStruct = PayloadStruct | ||
{ _payloadStructField1 :: Int | ||
} | ||
deriving (Eq, Show, Generic) | ||
|
||
deriveLensAndJSON ''PayloadStruct | ||
|
||
data BasicUnion | ||
= HasStringPayload Text | ||
| HasPayload PayloadStruct | ||
| HasNoPayload | ||
deriving (Eq, Show, Generic) | ||
|
||
instance ToJSON BasicUnion where | ||
toJSON = JSON.genericToJSON $ Helpers.gotynoOptions "type" | ||
|
||
instance FromJSON BasicUnion where | ||
parseJSON = JSON.genericParseJSON $ Helpers.gotynoOptions "type" |
Oops, something went wrong.