/usr/lib/hugs/packages/base/System/Posix/Types.hs is in libhugs-base-bundled 98.200609.21-5.3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | {-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Types
-- Copyright : (c) The University of Glasgow 2002
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : non-portable (requires POSIX)
--
-- POSIX data types: Haskell equivalents of the types defined by the
-- @\<sys\/types.h>@ C header on a POSIX system.
--
-----------------------------------------------------------------------------
module System.Posix.Types (
-- * POSIX data types
CDev,
CIno,
CMode,
COff,
CPid,
CSsize,
CGid,
CNlink,
CUid,
CCc,
CSpeed,
CTcflag,
CRLim,
Fd(..),
LinkCount,
UserID,
GroupID,
ByteCount,
ClockTick,
EpochTime,
FileOffset,
ProcessID,
ProcessGroupID,
DeviceID,
FileID,
FileMode,
Limit
) where
import Foreign
import Foreign.C
import Data.Typeable
import Data.Bits
import Control.Monad
newtype CDev = CDev Word64 deriving (Eq, Ord) ; instance Num CDev where { (CDev i) + (CDev j) = CDev (i + j) ; (CDev i) - (CDev j) = CDev (i - j) ; (CDev i) * (CDev j) = CDev (i * j) ; negate (CDev i) = CDev (negate i) ; abs (CDev i) = CDev (abs i) ; signum (CDev i) = CDev (signum i) ; fromInteger x = CDev (fromInteger x) } ; instance Real CDev where { toRational (CDev i) = toRational i } ; instance Read CDev where { readsPrec p s = map (\(x, t) -> (CDev x, t)) (readsPrec p s) } ; instance Show CDev where { showsPrec p (CDev x) = showsPrec p x } ; instance Enum CDev where { succ (CDev i) = CDev (succ i) ; pred (CDev i) = CDev (pred i) ; toEnum x = CDev (toEnum x) ; fromEnum (CDev i) = fromEnum i ; enumFrom (CDev i) = map CDev (enumFrom i) ; enumFromThen (CDev i) (CDev j) = map CDev (enumFromThen i j) ; enumFromTo (CDev i) (CDev j) = map CDev (enumFromTo i j) ; enumFromThenTo (CDev i) (CDev j) (CDev k) = map CDev (enumFromThenTo i j k) } ; instance Storable CDev where { sizeOf (CDev x) = sizeOf x ; alignment (CDev x) = alignment x ; peekElemOff a i = liftM CDev (peekElemOff (castPtr a) i) ; pokeElemOff a i (CDev x) = pokeElemOff (castPtr a) i x } ; tyConCDev = mkTyCon "CDev"; instance Typeable CDev where { typeOf _ = mkTyConApp tyConCDev [] } ;
newtype CIno = CIno Word64 deriving (Eq, Ord) ; instance Num CIno where { (CIno i) + (CIno j) = CIno (i + j) ; (CIno i) - (CIno j) = CIno (i - j) ; (CIno i) * (CIno j) = CIno (i * j) ; negate (CIno i) = CIno (negate i) ; abs (CIno i) = CIno (abs i) ; signum (CIno i) = CIno (signum i) ; fromInteger x = CIno (fromInteger x) } ; instance Real CIno where { toRational (CIno i) = toRational i } ; instance Read CIno where { readsPrec p s = map (\(x, t) -> (CIno x, t)) (readsPrec p s) } ; instance Show CIno where { showsPrec p (CIno x) = showsPrec p x } ; instance Enum CIno where { succ (CIno i) = CIno (succ i) ; pred (CIno i) = CIno (pred i) ; toEnum x = CIno (toEnum x) ; fromEnum (CIno i) = fromEnum i ; enumFrom (CIno i) = map CIno (enumFrom i) ; enumFromThen (CIno i) (CIno j) = map CIno (enumFromThen i j) ; enumFromTo (CIno i) (CIno j) = map CIno (enumFromTo i j) ; enumFromThenTo (CIno i) (CIno j) (CIno k) = map CIno (enumFromThenTo i j k) } ; instance Storable CIno where { sizeOf (CIno x) = sizeOf x ; alignment (CIno x) = alignment x ; peekElemOff a i = liftM CIno (peekElemOff (castPtr a) i) ; pokeElemOff a i (CIno x) = pokeElemOff (castPtr a) i x } ; tyConCIno = mkTyCon "CIno"; instance Typeable CIno where { typeOf _ = mkTyConApp tyConCIno [] } ; ; instance Bounded CIno where { minBound = CIno minBound ; maxBound = CIno maxBound } ; instance Integral CIno where { (CIno i) `quot` (CIno j) = CIno (i `quot` j) ; (CIno i) `rem` (CIno j) = CIno (i `rem` j) ; (CIno i) `div` (CIno j) = CIno (i `div` j) ; (CIno i) `mod` (CIno j) = CIno (i `mod` j) ; (CIno i) `quotRem` (CIno j) = let (q,r) = i `quotRem` j in (CIno q, CIno r) ; (CIno i) `divMod` (CIno j) = let (d,m) = i `divMod` j in (CIno d, CIno m) ; toInteger (CIno i) = toInteger i } ; instance Bits CIno where { (CIno x) .&. (CIno y) = CIno (x .&. y) ; (CIno x) .|. (CIno y) = CIno (x .|. y) ; (CIno x) `xor` (CIno y) = CIno (x `xor` y) ; complement (CIno x) = CIno (complement x) ; shift (CIno x) n = CIno (shift x n) ; rotate (CIno x) n = CIno (rotate x n) ; bit n = CIno (bit n) ; setBit (CIno x) n = CIno (setBit x n) ; clearBit (CIno x) n = CIno (clearBit x n) ; complementBit (CIno x) n = CIno (complementBit x n) ; testBit (CIno x) n = testBit x n ; bitSize (CIno x) = bitSize x ; isSigned (CIno x) = isSigned x }
newtype CMode = CMode Word32 deriving (Eq, Ord) ; instance Num CMode where { (CMode i) + (CMode j) = CMode (i + j) ; (CMode i) - (CMode j) = CMode (i - j) ; (CMode i) * (CMode j) = CMode (i * j) ; negate (CMode i) = CMode (negate i) ; abs (CMode i) = CMode (abs i) ; signum (CMode i) = CMode (signum i) ; fromInteger x = CMode (fromInteger x) } ; instance Real CMode where { toRational (CMode i) = toRational i } ; instance Read CMode where { readsPrec p s = map (\(x, t) -> (CMode x, t)) (readsPrec p s) } ; instance Show CMode where { showsPrec p (CMode x) = showsPrec p x } ; instance Enum CMode where { succ (CMode i) = CMode (succ i) ; pred (CMode i) = CMode (pred i) ; toEnum x = CMode (toEnum x) ; fromEnum (CMode i) = fromEnum i ; enumFrom (CMode i) = map CMode (enumFrom i) ; enumFromThen (CMode i) (CMode j) = map CMode (enumFromThen i j) ; enumFromTo (CMode i) (CMode j) = map CMode (enumFromTo i j) ; enumFromThenTo (CMode i) (CMode j) (CMode k) = map CMode (enumFromThenTo i j k) } ; instance Storable CMode where { sizeOf (CMode x) = sizeOf x ; alignment (CMode x) = alignment x ; peekElemOff a i = liftM CMode (peekElemOff (castPtr a) i) ; pokeElemOff a i (CMode x) = pokeElemOff (castPtr a) i x } ; tyConCMode = mkTyCon "CMode"; instance Typeable CMode where { typeOf _ = mkTyConApp tyConCMode [] } ; ; instance Bounded CMode where { minBound = CMode minBound ; maxBound = CMode maxBound } ; instance Integral CMode where { (CMode i) `quot` (CMode j) = CMode (i `quot` j) ; (CMode i) `rem` (CMode j) = CMode (i `rem` j) ; (CMode i) `div` (CMode j) = CMode (i `div` j) ; (CMode i) `mod` (CMode j) = CMode (i `mod` j) ; (CMode i) `quotRem` (CMode j) = let (q,r) = i `quotRem` j in (CMode q, CMode r) ; (CMode i) `divMod` (CMode j) = let (d,m) = i `divMod` j in (CMode d, CMode m) ; toInteger (CMode i) = toInteger i } ; instance Bits CMode where { (CMode x) .&. (CMode y) = CMode (x .&. y) ; (CMode x) .|. (CMode y) = CMode (x .|. y) ; (CMode x) `xor` (CMode y) = CMode (x `xor` y) ; complement (CMode x) = CMode (complement x) ; shift (CMode x) n = CMode (shift x n) ; rotate (CMode x) n = CMode (rotate x n) ; bit n = CMode (bit n) ; setBit (CMode x) n = CMode (setBit x n) ; clearBit (CMode x) n = CMode (clearBit x n) ; complementBit (CMode x) n = CMode (complementBit x n) ; testBit (CMode x) n = testBit x n ; bitSize (CMode x) = bitSize x ; isSigned (CMode x) = isSigned x }
newtype COff = COff Int64 deriving (Eq, Ord) ; instance Num COff where { (COff i) + (COff j) = COff (i + j) ; (COff i) - (COff j) = COff (i - j) ; (COff i) * (COff j) = COff (i * j) ; negate (COff i) = COff (negate i) ; abs (COff i) = COff (abs i) ; signum (COff i) = COff (signum i) ; fromInteger x = COff (fromInteger x) } ; instance Real COff where { toRational (COff i) = toRational i } ; instance Read COff where { readsPrec p s = map (\(x, t) -> (COff x, t)) (readsPrec p s) } ; instance Show COff where { showsPrec p (COff x) = showsPrec p x } ; instance Enum COff where { succ (COff i) = COff (succ i) ; pred (COff i) = COff (pred i) ; toEnum x = COff (toEnum x) ; fromEnum (COff i) = fromEnum i ; enumFrom (COff i) = map COff (enumFrom i) ; enumFromThen (COff i) (COff j) = map COff (enumFromThen i j) ; enumFromTo (COff i) (COff j) = map COff (enumFromTo i j) ; enumFromThenTo (COff i) (COff j) (COff k) = map COff (enumFromThenTo i j k) } ; instance Storable COff where { sizeOf (COff x) = sizeOf x ; alignment (COff x) = alignment x ; peekElemOff a i = liftM COff (peekElemOff (castPtr a) i) ; pokeElemOff a i (COff x) = pokeElemOff (castPtr a) i x } ; tyConCOff = mkTyCon "COff"; instance Typeable COff where { typeOf _ = mkTyConApp tyConCOff [] } ; ; instance Bounded COff where { minBound = COff minBound ; maxBound = COff maxBound } ; instance Integral COff where { (COff i) `quot` (COff j) = COff (i `quot` j) ; (COff i) `rem` (COff j) = COff (i `rem` j) ; (COff i) `div` (COff j) = COff (i `div` j) ; (COff i) `mod` (COff j) = COff (i `mod` j) ; (COff i) `quotRem` (COff j) = let (q,r) = i `quotRem` j in (COff q, COff r) ; (COff i) `divMod` (COff j) = let (d,m) = i `divMod` j in (COff d, COff m) ; toInteger (COff i) = toInteger i } ; instance Bits COff where { (COff x) .&. (COff y) = COff (x .&. y) ; (COff x) .|. (COff y) = COff (x .|. y) ; (COff x) `xor` (COff y) = COff (x `xor` y) ; complement (COff x) = COff (complement x) ; shift (COff x) n = COff (shift x n) ; rotate (COff x) n = COff (rotate x n) ; bit n = COff (bit n) ; setBit (COff x) n = COff (setBit x n) ; clearBit (COff x) n = COff (clearBit x n) ; complementBit (COff x) n = COff (complementBit x n) ; testBit (COff x) n = testBit x n ; bitSize (COff x) = bitSize x ; isSigned (COff x) = isSigned x }
newtype CPid = CPid Int32 deriving (Eq, Ord) ; instance Num CPid where { (CPid i) + (CPid j) = CPid (i + j) ; (CPid i) - (CPid j) = CPid (i - j) ; (CPid i) * (CPid j) = CPid (i * j) ; negate (CPid i) = CPid (negate i) ; abs (CPid i) = CPid (abs i) ; signum (CPid i) = CPid (signum i) ; fromInteger x = CPid (fromInteger x) } ; instance Real CPid where { toRational (CPid i) = toRational i } ; instance Read CPid where { readsPrec p s = map (\(x, t) -> (CPid x, t)) (readsPrec p s) } ; instance Show CPid where { showsPrec p (CPid x) = showsPrec p x } ; instance Enum CPid where { succ (CPid i) = CPid (succ i) ; pred (CPid i) = CPid (pred i) ; toEnum x = CPid (toEnum x) ; fromEnum (CPid i) = fromEnum i ; enumFrom (CPid i) = map CPid (enumFrom i) ; enumFromThen (CPid i) (CPid j) = map CPid (enumFromThen i j) ; enumFromTo (CPid i) (CPid j) = map CPid (enumFromTo i j) ; enumFromThenTo (CPid i) (CPid j) (CPid k) = map CPid (enumFromThenTo i j k) } ; instance Storable CPid where { sizeOf (CPid x) = sizeOf x ; alignment (CPid x) = alignment x ; peekElemOff a i = liftM CPid (peekElemOff (castPtr a) i) ; pokeElemOff a i (CPid x) = pokeElemOff (castPtr a) i x } ; tyConCPid = mkTyCon "CPid"; instance Typeable CPid where { typeOf _ = mkTyConApp tyConCPid [] } ; ; instance Bounded CPid where { minBound = CPid minBound ; maxBound = CPid maxBound } ; instance Integral CPid where { (CPid i) `quot` (CPid j) = CPid (i `quot` j) ; (CPid i) `rem` (CPid j) = CPid (i `rem` j) ; (CPid i) `div` (CPid j) = CPid (i `div` j) ; (CPid i) `mod` (CPid j) = CPid (i `mod` j) ; (CPid i) `quotRem` (CPid j) = let (q,r) = i `quotRem` j in (CPid q, CPid r) ; (CPid i) `divMod` (CPid j) = let (d,m) = i `divMod` j in (CPid d, CPid m) ; toInteger (CPid i) = toInteger i } ; instance Bits CPid where { (CPid x) .&. (CPid y) = CPid (x .&. y) ; (CPid x) .|. (CPid y) = CPid (x .|. y) ; (CPid x) `xor` (CPid y) = CPid (x `xor` y) ; complement (CPid x) = CPid (complement x) ; shift (CPid x) n = CPid (shift x n) ; rotate (CPid x) n = CPid (rotate x n) ; bit n = CPid (bit n) ; setBit (CPid x) n = CPid (setBit x n) ; clearBit (CPid x) n = CPid (clearBit x n) ; complementBit (CPid x) n = CPid (complementBit x n) ; testBit (CPid x) n = testBit x n ; bitSize (CPid x) = bitSize x ; isSigned (CPid x) = isSigned x }
newtype CSsize = CSsize Int64 deriving (Eq, Ord) ; instance Num CSsize where { (CSsize i) + (CSsize j) = CSsize (i + j) ; (CSsize i) - (CSsize j) = CSsize (i - j) ; (CSsize i) * (CSsize j) = CSsize (i * j) ; negate (CSsize i) = CSsize (negate i) ; abs (CSsize i) = CSsize (abs i) ; signum (CSsize i) = CSsize (signum i) ; fromInteger x = CSsize (fromInteger x) } ; instance Real CSsize where { toRational (CSsize i) = toRational i } ; instance Read CSsize where { readsPrec p s = map (\(x, t) -> (CSsize x, t)) (readsPrec p s) } ; instance Show CSsize where { showsPrec p (CSsize x) = showsPrec p x } ; instance Enum CSsize where { succ (CSsize i) = CSsize (succ i) ; pred (CSsize i) = CSsize (pred i) ; toEnum x = CSsize (toEnum x) ; fromEnum (CSsize i) = fromEnum i ; enumFrom (CSsize i) = map CSsize (enumFrom i) ; enumFromThen (CSsize i) (CSsize j) = map CSsize (enumFromThen i j) ; enumFromTo (CSsize i) (CSsize j) = map CSsize (enumFromTo i j) ; enumFromThenTo (CSsize i) (CSsize j) (CSsize k) = map CSsize (enumFromThenTo i j k) } ; instance Storable CSsize where { sizeOf (CSsize x) = sizeOf x ; alignment (CSsize x) = alignment x ; peekElemOff a i = liftM CSsize (peekElemOff (castPtr a) i) ; pokeElemOff a i (CSsize x) = pokeElemOff (castPtr a) i x } ; tyConCSsize = mkTyCon "CSsize"; instance Typeable CSsize where { typeOf _ = mkTyConApp tyConCSsize [] } ; ; instance Bounded CSsize where { minBound = CSsize minBound ; maxBound = CSsize maxBound } ; instance Integral CSsize where { (CSsize i) `quot` (CSsize j) = CSsize (i `quot` j) ; (CSsize i) `rem` (CSsize j) = CSsize (i `rem` j) ; (CSsize i) `div` (CSsize j) = CSsize (i `div` j) ; (CSsize i) `mod` (CSsize j) = CSsize (i `mod` j) ; (CSsize i) `quotRem` (CSsize j) = let (q,r) = i `quotRem` j in (CSsize q, CSsize r) ; (CSsize i) `divMod` (CSsize j) = let (d,m) = i `divMod` j in (CSsize d, CSsize m) ; toInteger (CSsize i) = toInteger i } ; instance Bits CSsize where { (CSsize x) .&. (CSsize y) = CSsize (x .&. y) ; (CSsize x) .|. (CSsize y) = CSsize (x .|. y) ; (CSsize x) `xor` (CSsize y) = CSsize (x `xor` y) ; complement (CSsize x) = CSsize (complement x) ; shift (CSsize x) n = CSsize (shift x n) ; rotate (CSsize x) n = CSsize (rotate x n) ; bit n = CSsize (bit n) ; setBit (CSsize x) n = CSsize (setBit x n) ; clearBit (CSsize x) n = CSsize (clearBit x n) ; complementBit (CSsize x) n = CSsize (complementBit x n) ; testBit (CSsize x) n = testBit x n ; bitSize (CSsize x) = bitSize x ; isSigned (CSsize x) = isSigned x }
newtype CGid = CGid Word32 deriving (Eq, Ord) ; instance Num CGid where { (CGid i) + (CGid j) = CGid (i + j) ; (CGid i) - (CGid j) = CGid (i - j) ; (CGid i) * (CGid j) = CGid (i * j) ; negate (CGid i) = CGid (negate i) ; abs (CGid i) = CGid (abs i) ; signum (CGid i) = CGid (signum i) ; fromInteger x = CGid (fromInteger x) } ; instance Real CGid where { toRational (CGid i) = toRational i } ; instance Read CGid where { readsPrec p s = map (\(x, t) -> (CGid x, t)) (readsPrec p s) } ; instance Show CGid where { showsPrec p (CGid x) = showsPrec p x } ; instance Enum CGid where { succ (CGid i) = CGid (succ i) ; pred (CGid i) = CGid (pred i) ; toEnum x = CGid (toEnum x) ; fromEnum (CGid i) = fromEnum i ; enumFrom (CGid i) = map CGid (enumFrom i) ; enumFromThen (CGid i) (CGid j) = map CGid (enumFromThen i j) ; enumFromTo (CGid i) (CGid j) = map CGid (enumFromTo i j) ; enumFromThenTo (CGid i) (CGid j) (CGid k) = map CGid (enumFromThenTo i j k) } ; instance Storable CGid where { sizeOf (CGid x) = sizeOf x ; alignment (CGid x) = alignment x ; peekElemOff a i = liftM CGid (peekElemOff (castPtr a) i) ; pokeElemOff a i (CGid x) = pokeElemOff (castPtr a) i x } ; tyConCGid = mkTyCon "CGid"; instance Typeable CGid where { typeOf _ = mkTyConApp tyConCGid [] } ; ; instance Bounded CGid where { minBound = CGid minBound ; maxBound = CGid maxBound } ; instance Integral CGid where { (CGid i) `quot` (CGid j) = CGid (i `quot` j) ; (CGid i) `rem` (CGid j) = CGid (i `rem` j) ; (CGid i) `div` (CGid j) = CGid (i `div` j) ; (CGid i) `mod` (CGid j) = CGid (i `mod` j) ; (CGid i) `quotRem` (CGid j) = let (q,r) = i `quotRem` j in (CGid q, CGid r) ; (CGid i) `divMod` (CGid j) = let (d,m) = i `divMod` j in (CGid d, CGid m) ; toInteger (CGid i) = toInteger i } ; instance Bits CGid where { (CGid x) .&. (CGid y) = CGid (x .&. y) ; (CGid x) .|. (CGid y) = CGid (x .|. y) ; (CGid x) `xor` (CGid y) = CGid (x `xor` y) ; complement (CGid x) = CGid (complement x) ; shift (CGid x) n = CGid (shift x n) ; rotate (CGid x) n = CGid (rotate x n) ; bit n = CGid (bit n) ; setBit (CGid x) n = CGid (setBit x n) ; clearBit (CGid x) n = CGid (clearBit x n) ; complementBit (CGid x) n = CGid (complementBit x n) ; testBit (CGid x) n = testBit x n ; bitSize (CGid x) = bitSize x ; isSigned (CGid x) = isSigned x }
newtype CNlink = CNlink Word64 deriving (Eq, Ord) ; instance Num CNlink where { (CNlink i) + (CNlink j) = CNlink (i + j) ; (CNlink i) - (CNlink j) = CNlink (i - j) ; (CNlink i) * (CNlink j) = CNlink (i * j) ; negate (CNlink i) = CNlink (negate i) ; abs (CNlink i) = CNlink (abs i) ; signum (CNlink i) = CNlink (signum i) ; fromInteger x = CNlink (fromInteger x) } ; instance Real CNlink where { toRational (CNlink i) = toRational i } ; instance Read CNlink where { readsPrec p s = map (\(x, t) -> (CNlink x, t)) (readsPrec p s) } ; instance Show CNlink where { showsPrec p (CNlink x) = showsPrec p x } ; instance Enum CNlink where { succ (CNlink i) = CNlink (succ i) ; pred (CNlink i) = CNlink (pred i) ; toEnum x = CNlink (toEnum x) ; fromEnum (CNlink i) = fromEnum i ; enumFrom (CNlink i) = map CNlink (enumFrom i) ; enumFromThen (CNlink i) (CNlink j) = map CNlink (enumFromThen i j) ; enumFromTo (CNlink i) (CNlink j) = map CNlink (enumFromTo i j) ; enumFromThenTo (CNlink i) (CNlink j) (CNlink k) = map CNlink (enumFromThenTo i j k) } ; instance Storable CNlink where { sizeOf (CNlink x) = sizeOf x ; alignment (CNlink x) = alignment x ; peekElemOff a i = liftM CNlink (peekElemOff (castPtr a) i) ; pokeElemOff a i (CNlink x) = pokeElemOff (castPtr a) i x } ; tyConCNlink = mkTyCon "CNlink"; instance Typeable CNlink where { typeOf _ = mkTyConApp tyConCNlink [] } ; ; instance Bounded CNlink where { minBound = CNlink minBound ; maxBound = CNlink maxBound } ; instance Integral CNlink where { (CNlink i) `quot` (CNlink j) = CNlink (i `quot` j) ; (CNlink i) `rem` (CNlink j) = CNlink (i `rem` j) ; (CNlink i) `div` (CNlink j) = CNlink (i `div` j) ; (CNlink i) `mod` (CNlink j) = CNlink (i `mod` j) ; (CNlink i) `quotRem` (CNlink j) = let (q,r) = i `quotRem` j in (CNlink q, CNlink r) ; (CNlink i) `divMod` (CNlink j) = let (d,m) = i `divMod` j in (CNlink d, CNlink m) ; toInteger (CNlink i) = toInteger i } ; instance Bits CNlink where { (CNlink x) .&. (CNlink y) = CNlink (x .&. y) ; (CNlink x) .|. (CNlink y) = CNlink (x .|. y) ; (CNlink x) `xor` (CNlink y) = CNlink (x `xor` y) ; complement (CNlink x) = CNlink (complement x) ; shift (CNlink x) n = CNlink (shift x n) ; rotate (CNlink x) n = CNlink (rotate x n) ; bit n = CNlink (bit n) ; setBit (CNlink x) n = CNlink (setBit x n) ; clearBit (CNlink x) n = CNlink (clearBit x n) ; complementBit (CNlink x) n = CNlink (complementBit x n) ; testBit (CNlink x) n = testBit x n ; bitSize (CNlink x) = bitSize x ; isSigned (CNlink x) = isSigned x }
newtype CUid = CUid Word32 deriving (Eq, Ord) ; instance Num CUid where { (CUid i) + (CUid j) = CUid (i + j) ; (CUid i) - (CUid j) = CUid (i - j) ; (CUid i) * (CUid j) = CUid (i * j) ; negate (CUid i) = CUid (negate i) ; abs (CUid i) = CUid (abs i) ; signum (CUid i) = CUid (signum i) ; fromInteger x = CUid (fromInteger x) } ; instance Real CUid where { toRational (CUid i) = toRational i } ; instance Read CUid where { readsPrec p s = map (\(x, t) -> (CUid x, t)) (readsPrec p s) } ; instance Show CUid where { showsPrec p (CUid x) = showsPrec p x } ; instance Enum CUid where { succ (CUid i) = CUid (succ i) ; pred (CUid i) = CUid (pred i) ; toEnum x = CUid (toEnum x) ; fromEnum (CUid i) = fromEnum i ; enumFrom (CUid i) = map CUid (enumFrom i) ; enumFromThen (CUid i) (CUid j) = map CUid (enumFromThen i j) ; enumFromTo (CUid i) (CUid j) = map CUid (enumFromTo i j) ; enumFromThenTo (CUid i) (CUid j) (CUid k) = map CUid (enumFromThenTo i j k) } ; instance Storable CUid where { sizeOf (CUid x) = sizeOf x ; alignment (CUid x) = alignment x ; peekElemOff a i = liftM CUid (peekElemOff (castPtr a) i) ; pokeElemOff a i (CUid x) = pokeElemOff (castPtr a) i x } ; tyConCUid = mkTyCon "CUid"; instance Typeable CUid where { typeOf _ = mkTyConApp tyConCUid [] } ; ; instance Bounded CUid where { minBound = CUid minBound ; maxBound = CUid maxBound } ; instance Integral CUid where { (CUid i) `quot` (CUid j) = CUid (i `quot` j) ; (CUid i) `rem` (CUid j) = CUid (i `rem` j) ; (CUid i) `div` (CUid j) = CUid (i `div` j) ; (CUid i) `mod` (CUid j) = CUid (i `mod` j) ; (CUid i) `quotRem` (CUid j) = let (q,r) = i `quotRem` j in (CUid q, CUid r) ; (CUid i) `divMod` (CUid j) = let (d,m) = i `divMod` j in (CUid d, CUid m) ; toInteger (CUid i) = toInteger i } ; instance Bits CUid where { (CUid x) .&. (CUid y) = CUid (x .&. y) ; (CUid x) .|. (CUid y) = CUid (x .|. y) ; (CUid x) `xor` (CUid y) = CUid (x `xor` y) ; complement (CUid x) = CUid (complement x) ; shift (CUid x) n = CUid (shift x n) ; rotate (CUid x) n = CUid (rotate x n) ; bit n = CUid (bit n) ; setBit (CUid x) n = CUid (setBit x n) ; clearBit (CUid x) n = CUid (clearBit x n) ; complementBit (CUid x) n = CUid (complementBit x n) ; testBit (CUid x) n = testBit x n ; bitSize (CUid x) = bitSize x ; isSigned (CUid x) = isSigned x }
newtype CCc = CCc Word8 deriving (Eq, Ord) ; instance Num CCc where { (CCc i) + (CCc j) = CCc (i + j) ; (CCc i) - (CCc j) = CCc (i - j) ; (CCc i) * (CCc j) = CCc (i * j) ; negate (CCc i) = CCc (negate i) ; abs (CCc i) = CCc (abs i) ; signum (CCc i) = CCc (signum i) ; fromInteger x = CCc (fromInteger x) } ; instance Real CCc where { toRational (CCc i) = toRational i } ; instance Read CCc where { readsPrec p s = map (\(x, t) -> (CCc x, t)) (readsPrec p s) } ; instance Show CCc where { showsPrec p (CCc x) = showsPrec p x } ; instance Enum CCc where { succ (CCc i) = CCc (succ i) ; pred (CCc i) = CCc (pred i) ; toEnum x = CCc (toEnum x) ; fromEnum (CCc i) = fromEnum i ; enumFrom (CCc i) = map CCc (enumFrom i) ; enumFromThen (CCc i) (CCc j) = map CCc (enumFromThen i j) ; enumFromTo (CCc i) (CCc j) = map CCc (enumFromTo i j) ; enumFromThenTo (CCc i) (CCc j) (CCc k) = map CCc (enumFromThenTo i j k) } ; instance Storable CCc where { sizeOf (CCc x) = sizeOf x ; alignment (CCc x) = alignment x ; peekElemOff a i = liftM CCc (peekElemOff (castPtr a) i) ; pokeElemOff a i (CCc x) = pokeElemOff (castPtr a) i x } ; tyConCCc = mkTyCon "CCc"; instance Typeable CCc where { typeOf _ = mkTyConApp tyConCCc [] } ;
newtype CSpeed = CSpeed Word32 deriving (Eq, Ord) ; instance Num CSpeed where { (CSpeed i) + (CSpeed j) = CSpeed (i + j) ; (CSpeed i) - (CSpeed j) = CSpeed (i - j) ; (CSpeed i) * (CSpeed j) = CSpeed (i * j) ; negate (CSpeed i) = CSpeed (negate i) ; abs (CSpeed i) = CSpeed (abs i) ; signum (CSpeed i) = CSpeed (signum i) ; fromInteger x = CSpeed (fromInteger x) } ; instance Real CSpeed where { toRational (CSpeed i) = toRational i } ; instance Read CSpeed where { readsPrec p s = map (\(x, t) -> (CSpeed x, t)) (readsPrec p s) } ; instance Show CSpeed where { showsPrec p (CSpeed x) = showsPrec p x } ; instance Enum CSpeed where { succ (CSpeed i) = CSpeed (succ i) ; pred (CSpeed i) = CSpeed (pred i) ; toEnum x = CSpeed (toEnum x) ; fromEnum (CSpeed i) = fromEnum i ; enumFrom (CSpeed i) = map CSpeed (enumFrom i) ; enumFromThen (CSpeed i) (CSpeed j) = map CSpeed (enumFromThen i j) ; enumFromTo (CSpeed i) (CSpeed j) = map CSpeed (enumFromTo i j) ; enumFromThenTo (CSpeed i) (CSpeed j) (CSpeed k) = map CSpeed (enumFromThenTo i j k) } ; instance Storable CSpeed where { sizeOf (CSpeed x) = sizeOf x ; alignment (CSpeed x) = alignment x ; peekElemOff a i = liftM CSpeed (peekElemOff (castPtr a) i) ; pokeElemOff a i (CSpeed x) = pokeElemOff (castPtr a) i x } ; tyConCSpeed = mkTyCon "CSpeed"; instance Typeable CSpeed where { typeOf _ = mkTyConApp tyConCSpeed [] } ;
newtype CTcflag = CTcflag Word32 deriving (Eq, Ord) ; instance Num CTcflag where { (CTcflag i) + (CTcflag j) = CTcflag (i + j) ; (CTcflag i) - (CTcflag j) = CTcflag (i - j) ; (CTcflag i) * (CTcflag j) = CTcflag (i * j) ; negate (CTcflag i) = CTcflag (negate i) ; abs (CTcflag i) = CTcflag (abs i) ; signum (CTcflag i) = CTcflag (signum i) ; fromInteger x = CTcflag (fromInteger x) } ; instance Real CTcflag where { toRational (CTcflag i) = toRational i } ; instance Read CTcflag where { readsPrec p s = map (\(x, t) -> (CTcflag x, t)) (readsPrec p s) } ; instance Show CTcflag where { showsPrec p (CTcflag x) = showsPrec p x } ; instance Enum CTcflag where { succ (CTcflag i) = CTcflag (succ i) ; pred (CTcflag i) = CTcflag (pred i) ; toEnum x = CTcflag (toEnum x) ; fromEnum (CTcflag i) = fromEnum i ; enumFrom (CTcflag i) = map CTcflag (enumFrom i) ; enumFromThen (CTcflag i) (CTcflag j) = map CTcflag (enumFromThen i j) ; enumFromTo (CTcflag i) (CTcflag j) = map CTcflag (enumFromTo i j) ; enumFromThenTo (CTcflag i) (CTcflag j) (CTcflag k) = map CTcflag (enumFromThenTo i j k) } ; instance Storable CTcflag where { sizeOf (CTcflag x) = sizeOf x ; alignment (CTcflag x) = alignment x ; peekElemOff a i = liftM CTcflag (peekElemOff (castPtr a) i) ; pokeElemOff a i (CTcflag x) = pokeElemOff (castPtr a) i x } ; tyConCTcflag = mkTyCon "CTcflag"; instance Typeable CTcflag where { typeOf _ = mkTyConApp tyConCTcflag [] } ; ; instance Bounded CTcflag where { minBound = CTcflag minBound ; maxBound = CTcflag maxBound } ; instance Integral CTcflag where { (CTcflag i) `quot` (CTcflag j) = CTcflag (i `quot` j) ; (CTcflag i) `rem` (CTcflag j) = CTcflag (i `rem` j) ; (CTcflag i) `div` (CTcflag j) = CTcflag (i `div` j) ; (CTcflag i) `mod` (CTcflag j) = CTcflag (i `mod` j) ; (CTcflag i) `quotRem` (CTcflag j) = let (q,r) = i `quotRem` j in (CTcflag q, CTcflag r) ; (CTcflag i) `divMod` (CTcflag j) = let (d,m) = i `divMod` j in (CTcflag d, CTcflag m) ; toInteger (CTcflag i) = toInteger i } ; instance Bits CTcflag where { (CTcflag x) .&. (CTcflag y) = CTcflag (x .&. y) ; (CTcflag x) .|. (CTcflag y) = CTcflag (x .|. y) ; (CTcflag x) `xor` (CTcflag y) = CTcflag (x `xor` y) ; complement (CTcflag x) = CTcflag (complement x) ; shift (CTcflag x) n = CTcflag (shift x n) ; rotate (CTcflag x) n = CTcflag (rotate x n) ; bit n = CTcflag (bit n) ; setBit (CTcflag x) n = CTcflag (setBit x n) ; clearBit (CTcflag x) n = CTcflag (clearBit x n) ; complementBit (CTcflag x) n = CTcflag (complementBit x n) ; testBit (CTcflag x) n = testBit x n ; bitSize (CTcflag x) = bitSize x ; isSigned (CTcflag x) = isSigned x }
newtype CRLim = CRLim Word64 deriving (Eq, Ord) ; instance Num CRLim where { (CRLim i) + (CRLim j) = CRLim (i + j) ; (CRLim i) - (CRLim j) = CRLim (i - j) ; (CRLim i) * (CRLim j) = CRLim (i * j) ; negate (CRLim i) = CRLim (negate i) ; abs (CRLim i) = CRLim (abs i) ; signum (CRLim i) = CRLim (signum i) ; fromInteger x = CRLim (fromInteger x) } ; instance Real CRLim where { toRational (CRLim i) = toRational i } ; instance Read CRLim where { readsPrec p s = map (\(x, t) -> (CRLim x, t)) (readsPrec p s) } ; instance Show CRLim where { showsPrec p (CRLim x) = showsPrec p x } ; instance Enum CRLim where { succ (CRLim i) = CRLim (succ i) ; pred (CRLim i) = CRLim (pred i) ; toEnum x = CRLim (toEnum x) ; fromEnum (CRLim i) = fromEnum i ; enumFrom (CRLim i) = map CRLim (enumFrom i) ; enumFromThen (CRLim i) (CRLim j) = map CRLim (enumFromThen i j) ; enumFromTo (CRLim i) (CRLim j) = map CRLim (enumFromTo i j) ; enumFromThenTo (CRLim i) (CRLim j) (CRLim k) = map CRLim (enumFromThenTo i j k) } ; instance Storable CRLim where { sizeOf (CRLim x) = sizeOf x ; alignment (CRLim x) = alignment x ; peekElemOff a i = liftM CRLim (peekElemOff (castPtr a) i) ; pokeElemOff a i (CRLim x) = pokeElemOff (castPtr a) i x } ; tyConCRlim = mkTyCon "CRLim"; instance Typeable CRLim where { typeOf _ = mkTyConApp tyConCRlim [] } ; ; instance Bounded CRLim where { minBound = CRLim minBound ; maxBound = CRLim maxBound } ; instance Integral CRLim where { (CRLim i) `quot` (CRLim j) = CRLim (i `quot` j) ; (CRLim i) `rem` (CRLim j) = CRLim (i `rem` j) ; (CRLim i) `div` (CRLim j) = CRLim (i `div` j) ; (CRLim i) `mod` (CRLim j) = CRLim (i `mod` j) ; (CRLim i) `quotRem` (CRLim j) = let (q,r) = i `quotRem` j in (CRLim q, CRLim r) ; (CRLim i) `divMod` (CRLim j) = let (d,m) = i `divMod` j in (CRLim d, CRLim m) ; toInteger (CRLim i) = toInteger i } ; instance Bits CRLim where { (CRLim x) .&. (CRLim y) = CRLim (x .&. y) ; (CRLim x) .|. (CRLim y) = CRLim (x .|. y) ; (CRLim x) `xor` (CRLim y) = CRLim (x `xor` y) ; complement (CRLim x) = CRLim (complement x) ; shift (CRLim x) n = CRLim (shift x n) ; rotate (CRLim x) n = CRLim (rotate x n) ; bit n = CRLim (bit n) ; setBit (CRLim x) n = CRLim (setBit x n) ; clearBit (CRLim x) n = CRLim (clearBit x n) ; complementBit (CRLim x) n = CRLim (complementBit x n) ; testBit (CRLim x) n = testBit x n ; bitSize (CRLim x) = bitSize x ; isSigned (CRLim x) = isSigned x }
-- ToDo: blksize_t, clockid_t, blkcnt_t, fsblkcnt_t, fsfilcnt_t, id_t, key_t
-- suseconds_t, timer_t, useconds_t
-- Make an Fd type rather than using CInt everywhere
newtype Fd = Fd CInt deriving (Eq, Ord) ; instance Num Fd where { (Fd i) + (Fd j) = Fd (i + j) ; (Fd i) - (Fd j) = Fd (i - j) ; (Fd i) * (Fd j) = Fd (i * j) ; negate (Fd i) = Fd (negate i) ; abs (Fd i) = Fd (abs i) ; signum (Fd i) = Fd (signum i) ; fromInteger x = Fd (fromInteger x) } ; instance Real Fd where { toRational (Fd i) = toRational i } ; instance Read Fd where { readsPrec p s = map (\(x, t) -> (Fd x, t)) (readsPrec p s) } ; instance Show Fd where { showsPrec p (Fd x) = showsPrec p x } ; instance Enum Fd where { succ (Fd i) = Fd (succ i) ; pred (Fd i) = Fd (pred i) ; toEnum x = Fd (toEnum x) ; fromEnum (Fd i) = fromEnum i ; enumFrom (Fd i) = map Fd (enumFrom i) ; enumFromThen (Fd i) (Fd j) = map Fd (enumFromThen i j) ; enumFromTo (Fd i) (Fd j) = map Fd (enumFromTo i j) ; enumFromThenTo (Fd i) (Fd j) (Fd k) = map Fd (enumFromThenTo i j k) } ; instance Storable Fd where { sizeOf (Fd x) = sizeOf x ; alignment (Fd x) = alignment x ; peekElemOff a i = liftM Fd (peekElemOff (castPtr a) i) ; pokeElemOff a i (Fd x) = pokeElemOff (castPtr a) i x } ; tyConFd = mkTyCon "Fd"; instance Typeable Fd where { typeOf _ = mkTyConApp tyConFd [] } ; ; instance Bounded Fd where { minBound = Fd minBound ; maxBound = Fd maxBound } ; instance Integral Fd where { (Fd i) `quot` (Fd j) = Fd (i `quot` j) ; (Fd i) `rem` (Fd j) = Fd (i `rem` j) ; (Fd i) `div` (Fd j) = Fd (i `div` j) ; (Fd i) `mod` (Fd j) = Fd (i `mod` j) ; (Fd i) `quotRem` (Fd j) = let (q,r) = i `quotRem` j in (Fd q, Fd r) ; (Fd i) `divMod` (Fd j) = let (d,m) = i `divMod` j in (Fd d, Fd m) ; toInteger (Fd i) = toInteger i } ; instance Bits Fd where { (Fd x) .&. (Fd y) = Fd (x .&. y) ; (Fd x) .|. (Fd y) = Fd (x .|. y) ; (Fd x) `xor` (Fd y) = Fd (x `xor` y) ; complement (Fd x) = Fd (complement x) ; shift (Fd x) n = Fd (shift x n) ; rotate (Fd x) n = Fd (rotate x n) ; bit n = Fd (bit n) ; setBit (Fd x) n = Fd (setBit x n) ; clearBit (Fd x) n = Fd (clearBit x n) ; complementBit (Fd x) n = Fd (complementBit x n) ; testBit (Fd x) n = testBit x n ; bitSize (Fd x) = bitSize x ; isSigned (Fd x) = isSigned x }
-- nicer names, and backwards compatibility with POSIX library:
type LinkCount = CNlink
type UserID = CUid
type GroupID = CGid
type ByteCount = CSize
type ClockTick = CClock
type EpochTime = CTime
type DeviceID = CDev
type FileID = CIno
type FileMode = CMode
type ProcessID = CPid
type FileOffset = COff
type ProcessGroupID = CPid
type Limit = CLong
|