Re:Gluon – A static, type-inferred and embeddable language w...
by popnroll on Friday June 22, 2018 @07:44PM
(#17378479)
getChar is a Haskell function without arguments.
[ Parent
| on HN ]
Re:Gluon – A static, type-inferred and embeddable language w...
by somenewacc on Saturday June 23, 2018 @12:28PM
(#17381976)
In Haskell, getChar isn't a function (something of type a -> b), its type is IO Char
http://hackage.haskell.org/package/base-4.11.1.0/docs/Prelud...
It represents an interaction with the outside world that results in a Char when you perform it. It isn't a function because in Haskell functions must be pure (with no side effects).
Re:Gluon – A static, type-inferred and embeddable language w...
by Miky on Friday June 22, 2018 @08:16PM
(#17378615)
This is false. getChar is a constant.
Re:Gluon – A static, type-inferred and embeddable language w...
by popnroll on Friday June 22, 2018 @09:22PM
(#17378874)
I am confused :S
From your other post: "In both Gluon and Haskell, functions without arguments can be represented as functions over the unit type: f: () -> SomeType"
Isn't `f` a constant here too?, how is this different than getChar? (I get I don't understand something here but not sure what)
Re:Gluon – A static, type-inferred and embeddable language w...
by Rusky on Saturday June 23, 2018 @12:06AM
(#17379485)
`getChar` is not of type `() -> SomeType`, but directly of type `SomeType`.
(Though yes, `f` also is a constant... it's just a constant that happens to be a function, which `getChar` is not.)
Re:Gluon – A static, type-inferred and embeddable language w...
by tome on Sunday June 24, 2018 @02:27AM
(#17385271)
I feel the responses to you were somewhat unhelpful. Would they also claim that something of type `MyFun Char` is not a function, where
data MyFun a = MyFun (() -> Char)
Technically they'd be right.