Skip to content

Commit df535f5

Browse files
committed
[Char] -> String
1 parent 6d4cca9 commit df535f5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

source_md/making-our-own-types-and-typeclasses.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ Let's make some `Frank` values and check out their types.
18761876

18771877
```{.haskell:hs}
18781878
ghci> :t Frank {frankField = Just "HAHA"}
1879-
Frank {frankField = Just "HAHA"} :: Frank [Char] Maybe
1879+
Frank {frankField = Just "HAHA"} :: Frank String Maybe
18801880
ghci> :t Frank {frankField = Node 'a' EmptyTree EmptyTree}
18811881
Frank {frankField = Node 'a' EmptyTree EmptyTree} :: Frank Char Tree
18821882
ghci> :t Frank {frankField = "YES"}
@@ -1885,9 +1885,9 @@ Frank {frankField = "YES"} :: Frank Char []
18851885

18861886
Hmm.
18871887
Because `frankField` has a type of form `a b`, its values must have types that are of a similar form as well.
1888-
So they can be `Just "HAHA"`, which has a type of `Maybe [Char]` or it can have a value of `['Y','E','S']`, which has a type of `[Char]` (if we used our own list type for this, it would have a type of `List Char`).
1888+
So they can be `Just "HAHA"`, which has a type of `Maybe String` or it can have a value of `['Y','E','S']`, which has a type of `[Char]` (if we used our own list type for this, it would have a type of `List Char`).
18891889
And we see that the types of the `Frank` values correspond with the kind for `Frank`.
1890-
`[Char]` has a kind of `*` and `Maybe` has a kind of `* -> *`.
1890+
`String` has a kind of `*` and `Maybe` has a kind of `* -> *`.
18911891
Because in order to have a value, it has to be a concrete type and thus has to be fully applied, every value of `Frank blah blaah` has a kind of `*`.
18921892

18931893
Making `Frank` an instance of `Tofu` is pretty simple.
@@ -1902,7 +1902,7 @@ instance Tofu Frank where
19021902
```{.haskell:hs}
19031903
ghci> tofu (Just 'a') :: Frank Char Maybe
19041904
Frank {frankField = Just 'a'}
1905-
ghci> tofu ["HELLO"] :: Frank [Char] []
1905+
ghci> tofu ["HELLO"] :: Frank String []
19061906
Frank {frankField = ["HELLO"]}
19071907
```
19081908

0 commit comments

Comments
 (0)