[Haskell-cafe] Help understanding this type

Theodore Lief Gannon tanuki at gmail.com
Wed Nov 7 10:28:53 UTC 2018


The meaning of XEvent is different on the left and right sides of the
newtype declaration. On the left, it's a type; on the right, it's a data
constructor. The constructor wraps a value which refers to the type, but
not recursively back to the constructor itself.

On Tue, Nov 6, 2018, 8:36 AM Guru Devanla <gurudev.devanla at gmail.com wrote:

> Hello Haskell-Cafe,
>
> I have been recently studying the XMonad code and some related types
> available in the X11 bindings library.
>
> I came across this type:
>
> newtype XEvent = XEvent XEventPtr
>
> type XEventPtr = Ptr
> <http://hackage.haskell.org/package/base-4.10.1.0/docs/Foreign-Ptr.html#t:Ptr>
> XEvent
> <http://hackage.haskell.org/package/X11-1.9/docs/Graphics-X11-Xlib-Event.html#t:XEvent>
>
> Available here:
>
> http://hackage.haskell.org/package/X11-1.9/docs/Graphics-X11-Xlib-Event.html#t:XEvent
>
> It seems that this type is circular here. how does one use this type? Is
> it possible to create a value out of this type? What is the use of this
> type?
>
> Please could someone help me wrap my head around this?
>
> Thanks
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20181107/b6ee4dd0/attachment.html>


More information about the Haskell-Cafe mailing list