# First time using Haskell

**URL:** <https://discourse.haskell.org/t/first-time-using-haskell/4094>\
**Category:** Learn\
**Created:** [February 13, 2022, 8:52pm UTC](https://discourse.haskell.org/t/first-time-using-haskell/4094 "2022-02-13T20:52:08Z")\
**Posts on this page:** 1\
**Showing post:** 30

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [February 15, 2022, 3:05pm UTC](https://discourse.haskell.org/t/first-time-using-haskell/4094/30 "2022-02-15T15:05:47Z")

</div>

In Haskell it is more common to use the peano construction:

```haskell
data Nat = Zero | Succ Nat

```

Of course just using the `Integer` (or [`Natural`](https://hackage.haskell.org/package/base-4.16.0.0/docs/Numeric-Natural.html#t:Natural)) type is much faster.

Why would you need von Neumann ordinals specifically?

Edit: I think you can do Neumann ordinals like this I guess:

```haskell
import qualified Data.Set as Set

newtype NestedSet = NestedSet { getNestedSet :: Set.Set NestedSet }
  deriving (Eq, Ord, Show)

hh :: [NestedSet]
hh = iterate (\x -> NestedSet (Set.insert x (getNestedSet x))) (NestedSet Set.empty)

```

And again in GHCi:

```haskell
ghci> mapM_ print $ take 4 hh
NestedSet {getNestedSet = fromList []}
NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []}]}
NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []},NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []}]}]}
NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []},NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []}]},NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []},NestedSet {getNestedSet = fromList [NestedSet {getNestedSet = fromList []}]}]}]}

```

---

_[View the full topic](https://discourse.haskell.org/t/first-time-using-haskell/4094)._
