<commit_before>{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
#include <chsmpfr.h>
#include <mpfr.h>

module Data.Number.MPFR.FFIhelper where

import Data.Word

import Data.Int

import Foreign.C.String(CString)
import Foreign.C.Types(CULong, CLong, CInt, CUInt, CDouble, CChar)
import Foreign.Ptr(Ptr)
import Foreign.Marshal(alloca)
import Foreign.Storable
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr, mallocForeignPtrBytes)

import Data.Typeable(Typeable)

import Data.Function(on)
    
data RoundMode = Near | Zero | Up | Down | GMP_RND_MAX | GMP_RNDNA 

instance Enum RoundMode where
    fromEnum Near        = #{const GMP_RNDN} 
    fromEnum Zero        = #{const GMP_RNDZ} 
    fromEnum Up          = #{const GMP_RNDU} <commit_msg>Added Show and Read instances for RoundMode<commit_after>{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
#include <chsmpfr.h>
#include <mpfr.h>

module Data.Number.MPFR.FFIhelper where

import Data.Word

import Data.Int

import Foreign.C.String(CString)
import Foreign.C.Types(CULong, CLong, CInt, CUInt, CDouble, CChar)
import Foreign.Ptr(Ptr)
import Foreign.Marshal(alloca)
import Foreign.Storable
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr, mallocForeignPtrBytes)

import Data.Typeable(Typeable)

import Data.Function(on)
    
data RoundMode = Near | Zero | Up | Down | GMP_RND_MAX | GMP_RNDNA 
                 deriving (Show, Read)

instance Enum RoundMode where
    fromEnum Near        = #{const GMP_RNDN} 
    fromEnum Zero        = #{const GMP_RNDZ} 
    fromEnum Up          = #{const GMP_RNDU} 
{'fraction_non_alphanumeric': 0.0904675166970249, 'fraction_numerical': 0.0, 'mean_word_length': 4.26517571884984, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4209366', 'n_tokens_mistral': 550, 'n_tokens_neox': 543, 'n_words': 137}