symengine/symengine.hs

View on GitHub

Showing 21 of 21 total issues

Eta reduce
Open

withBasicSym p f = withForeignPtr (fptr p ) f
Severity: Minor
Found in src/Symengine.hs by hlint

Found

withBasicSym p f = withForeignPtr (fptr p) f

Why not

withBasicSym p = withForeignPtr (fptr p)

Eta reduce
Open

complex a b = (basic_binaryop complex_set_ffi) a b
Severity: Minor
Found in src/Symengine.hs by hlint

Found

complex a b = (basic_binaryop complex_set_ffi) a b

Why not

complex = (basic_binaryop complex_set_ffi)

Eta reduce
Open

diff expr symbol = (basic_binaryop basic_diff_ffi) expr symbol
Severity: Minor
Found in src/Symengine.hs by hlint

Found

diff expr symbol = (basic_binaryop basic_diff_ffi) expr symbol

Why not

diff = (basic_binaryop basic_diff_ffi)

Use camelCase
Open

basic_str basic_ptr = unsafePerformIO $ withBasicSym basic_ptr (basic_str_ffi >=> peekCString)
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_str basic_ptr = ...

Why not

basicStr basic_ptr = ...

Use newtype instead of data
Open

data BasicStruct = BasicStruct {
    data_ptr :: Ptr ()
}
Severity: Minor
Found in src/Symengine.hs by hlint

Found

data BasicStruct = BasicStruct{data_ptr :: Ptr ()}

Why not

newtype BasicStruct = BasicStruct{data_ptr :: Ptr ()}

Applying this change:

  • decreases laziness

Use newtype instead of data
Open

data BasicSym = BasicSym { fptr :: ForeignPtr BasicStruct }
Severity: Minor
Found in src/Symengine.hs by hlint

Found

data BasicSym = BasicSym{fptr :: ForeignPtr BasicStruct}

Why not

newtype BasicSym = BasicSym{fptr :: ForeignPtr BasicStruct}

Applying this change:

  • decreases laziness

Redundant bracket
Open

complex a b = (basic_binaryop complex_set_ffi) a b
Severity: Minor
Found in src/Symengine.hs by hlint

Found

(basic_binaryop complex_set_ffi) a

Why not

basic_binaryop complex_set_ffi a

Use camelCase
Open

create_basic_ptr = do
    basic_ptr <- newArray [BasicStruct { data_ptr = nullPtr }]
    basic_new_heap_ffi basic_ptr
    finalized_ptr <- newForeignPtr ptr_basic_free_heap_ffi basic_ptr
    return $ BasicSym { fptr = finalized_ptr }
Severity: Minor
Found in src/Symengine.hs by hlint

Found

create_basic_ptr = ...

Why not

createBasicPtr = ...

Redundant bracket
Open

diff expr symbol = (basic_binaryop basic_diff_ffi) expr symbol
Severity: Minor
Found in src/Symengine.hs by hlint

Found

(basic_binaryop basic_diff_ffi) expr

Why not

basic_binaryop basic_diff_ffi expr

Avoid lambda
Open

withBasicSym3 p1 p2 p3 f = withBasicSym p1 (\p1 -> withBasicSym p2 (\p2 -> withBasicSym p3 (\p3 -> f p1 p2 p3)))
Severity: Minor
Found in src/Symengine.hs by hlint

Found

\ p3 -> f p1 p2 p3

Why not

f p1 p2

Use camelCase
Open

basic_int_signed i = unsafePerformIO $ do
    iptr <- create_basic_ptr
    withBasicSym iptr (\iptr -> integer_set_si_ffi iptr (intToCLong i) )
    return iptr
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_int_signed i = ...

Why not

basicIntSigned i = ...

Use camelCase
Open

basic_pow = basic_binaryop basic_pow_ffi
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_pow = ...

Why not

basicPow = ...

Use camelCase
Open

basic_binaryop f a b = unsafePerformIO $ do
    s <- create_basic_ptr
    withBasicSym3 s a b f
    return s 
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_binaryop f a b = ...

Why not

basicBinaryop f a b = ...

Avoid lambda
Open

    withBasicSym s (\s -> symbol_set_ffi s cname)
Severity: Minor
Found in src/Symengine.hs by hlint

Found

\ s -> symbol_set_ffi s cname

Why not

(`symbol_set_ffi` cname)

Use camelCase
Open

basic_unaryop f a = unsafePerformIO $ do
    s <- create_basic_ptr
    withBasicSym2 s a f
    return s 
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_unaryop f a = ...

Why not

basicUnaryop f a = ...

Use camelCase
Open

basic_rational_from_integer i j = unsafePerformIO $ do
    s <- create_basic_ptr
    withBasicSym s (\s -> rational_set_si_ffi s (integerToCLong i) (integerToCLong j))
    return s 
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_rational_from_integer i j = ...

Why not

basicRationalFromInteger i j = ...

Use camelCase
Open

basic_from_integer i = unsafePerformIO $ do
    iptr <- create_basic_ptr
    withBasicSym iptr (\iptr -> integer_set_si_ffi iptr (fromInteger i))
    return iptr
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_from_integer i = ...

Why not

basicFromInteger i = ...

Use camelCase
Open

minus_one = basic_obj_constructor basic_const_minus_one_ffi
Severity: Minor
Found in src/Symengine.hs by hlint

Found

minus_one = ...

Why not

minusOne = ...

Use camelCase
Open

basic_obj_constructor init_fn = unsafePerformIO $ do
    basic_ptr <- create_basic_ptr
    withBasicSym basic_ptr init_fn
    return basic_ptr
Severity: Minor
Found in src/Symengine.hs by hlint

Found

basic_obj_constructor init_fn = ...

Why not

basicObjConstructor init_fn = ...

Avoid lambda
Open

withBasicSym2 p1 p2 f = withBasicSym p1 (\p1 -> withBasicSym p2 (\p2 -> f p1 p2))
Severity: Minor
Found in src/Symengine.hs by hlint

Found

\ p2 -> f p1 p2

Why not

f p1
Severity
Category
Status
Source
Language