| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sat, 17 Jan 2026 18:55:10 GMT
X-Served-By: cache-dfw-kdfw8210148-DFW, cache-bom-vanm7210038-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768676110.386344,VS0,VE468
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
shwifty: Generate swift types from haskell types.
[Skip to Readme]
shwifty: Generate swift types from haskell types.
Shwifty provides many utilities for generating swift types from haskell types, with great flexibility in representation, and emphasis on generating typesafe Swift code. Most of the types representable in Haskell98 are supported.
[Skip to Readme]
Downloads
- shwifty-0.0.3.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.0.1.0, 0.0.2.0, 0.0.3.0 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | base (>=4.11 && <4.15), bytestring (>=0.10 && <0.11), case-insensitive (>=1.2 && <1.3), containers (>=0.5.9 && <0.7), mtl (>=2.2 && <2.3), primitive (>=0.6.4 && <0.8), template-haskell (>=2.11 && <2.17), text (>=1.2 && <1.3), th-abstraction (>=0.3 && <0.4), time (>=1.8 && <1.11), unordered-containers (>=0.2 && <0.3), uuid-types (>=1.0 && <1.1), vector (>=0.12 && <0.13) [details] |
| License | MIT |
| Copyright | Copyright (c) 2020, chessai |
| Author | chessai |
| Maintainer | chessai <chessai1996@gmail.com> |
| Uploaded | by chessai at 2020-05-31T04:05:48Z |
| Category | Codegen, Text, TemplateHaskell |
| Bug tracker | https://github.com/chessai/shwifty/issues |
| Source repo | head: git clone git://github.com/chessai/shwifty.git |
| Distributions | |
| Downloads | 808 total (10 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2020-05-31 [all 1 reports] |
Readme for shwifty-0.0.3.0
[back to package description]Shwifty
Generate Swift types from Haskell types
Examples:
A simple sum type
data SumType = Sum1 | Sum2 | Sum3
getShwifty ''SumType
enum SumType {
case sum1
case sum2
case sum3
}
A simple product type
data ProductType = ProductType { x :: Int, y :: Int }
getShwifty ''ProductType
struct ProductType {
let x: Int
let y: Int
}
A sum type with type variables
data SumType a b = SumL a | SumR b
getShwifty ''SumType
enum SumType<A, B> {
case sumL(A)
case sumR(B)
}
A product type with type variables
data ProductType a b = ProductType
{ aField :: a
, bField :: b
}
getShwifty ''ProductType
struct ProductType<A, B> {
let aField: A
let bField: B
}
A newtype
newtype Newtype a = Newtype { getNewtype :: a }
getShwifty ''Newtype
struct Newtype<A> {
let getNewtype: A
}
A type with a function field
newtype Endo a = Endo { appEndo :: a -> a }
getShwifty ''Endo
struct Endo<A> {
let appEndo: ((A) -> A)
}
A weird type with nested fields. Also note the Result's types being flipped from that of the Either.
data YouveGotProblems a b = YouveGotProblems
{ field1 :: Maybe (Maybe (Maybe a))
, field2 :: Either (Maybe a) (Maybe b)
}
getShwifty ''YouveGotProblems
struct YouveGotProblems<A, B> {
let field1: A???
let field2: Result<B?, A?>
}
A type with polykinded type variables
data PolyKinded (a :: k) = PolyKinded
getShwifty ''PolyKinded
struct PolyKinded<A> { }
A sum type where constructors might be records
data SumType a b (c :: k)
= Sum1 Int a (Maybe b)
| Sum2 b
| Sum3 { x :: Int, y :: Int }
getShwifty ''SumType
enum SumType<A, B, C> {
case field1(Int, A, B?)
case field2(B)
case field3(_ x: Int, _ y: Int)
}
A type containing another type with instance generated by 'getShwifty'
newtype MyFirstType a = MyFirstType { getMyFirstType :: a }
getShwifty ''MyFirstType
data Contains a = Contains
{ x :: MyFirstType Int
, y :: MyFirstType a
}
getShwifty ''Contains
struct MyFirstType<A> {
let getMyFirstType: A
}
struct Contains<A> {
let x: MyFirstType<Int>
let y: MyFirstType<A>
}